An async Telegram Bot API client with built-in rich-message support.
Project description
Moonlygram
A modern, async Python framework for the Telegram Bot API, with built-in rich messages.
Pure HTTP. No MTProto. No native dependencies.
Description
Moonlygram is an asynchronous framework for the Telegram Bot API. A Bot holds the API
methods and an Application (moonlygram.ext) registers handlers and runs the update loop, so
the shape feels familiar if you have used python-telegram-bot.
On top of that, it adds something no other library has: rich messages (Bot API 10.1).
Installation
pip install moonlygram
Requires Python 3.10 or newer.
Usage
from moonlygram import InlineKeyboardButton, InlineKeyboardMarkup
from moonlygram.ext import Application, CallbackQueryHandler, CommandHandler
async def start(update, context):
keyboard = InlineKeyboardMarkup([[InlineKeyboardButton("Tap me", callback_data="tapped")]])
await update.message.reply_text("Hello from Moonlygram!", reply_markup=keyboard)
async def on_tap(update, context):
await update.callback_query.answer("You tapped it!")
app = Application.builder().token("YOUR_BOT_TOKEN").build()
app.add_handler(CommandHandler("start", start))
app.add_handler(CallbackQueryHandler(on_tap, pattern="^tapped$"))
app.run_polling()
Features
- Familiar: a python-telegram-bot-style API:
Application, handlers, filters, and(update, context)callbacks. Existing bots port with little more than renamed imports. - Async: receiving and dispatch run concurrently, so a slow handler never stalls the next update.
- Performant: a non-blocking poll loop, optional parallel dispatch, a built-in rate limiter,
and a dependency-free
JobQueue. - Rich: send Bot API 10.1 rich messages (headings, tables, collapsibles, math) with a composable, auto-escaping builder, or convert Markdown in one call. No other library has this.
- Type-hinted: ships
py.typedand passesmypy --strict. The received types are generated from the Bot API schema, so they cannot silently drift. - Lightweight: one dependency (
httpx). Pure HTTP, with no MTProto, noapi_id/api_hash, and no C extensions. - Batteries included: conversations, persistence, scheduled jobs, arbitrary callback data, and both polling and webhooks.
Resources
- Documentation: https://atarixiafamine.github.io/Moonlygram/
- Migrating from python-telegram-bot: https://atarixiafamine.github.io/Moonlygram/migrating/
- Examples:
examples/ - Changelog:
CHANGELOG.md
Roadmap
Core messaging, media, chat and member administration, bot configuration, forum topics, stickers, and inline mode are all covered. Still in progress: the niche Bot API domains of payments / Telegram Stars, business accounts, games, and passport / giveaways / paid media.
Contributing
Contributions are welcome. See CONTRIBUTING.md; it covers the spec-driven
codegen workflow for data types (edit the spec or overrides, regenerate, then test).
License
Released under the MIT License. See LICENSE. Copyright © 2026 AtarixiaFamine.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file moonlygram-0.1.0.tar.gz.
File metadata
- Download URL: moonlygram-0.1.0.tar.gz
- Upload date:
- Size: 179.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b19cf043e9bff893138e20e056ee38b65156605a447c48e9e5e26f3336ee6187
|
|
| MD5 |
44c38b8d6ece6f15ea3d496275dba3fb
|
|
| BLAKE2b-256 |
89d7616079b9b881c72eed0bd422754ab3c4f127d0758c2a1431daee7ee45f80
|
Provenance
The following attestation bundles were made for moonlygram-0.1.0.tar.gz:
Publisher:
release.yml on AtarixiaFamine/Moonlygram
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
moonlygram-0.1.0.tar.gz -
Subject digest:
b19cf043e9bff893138e20e056ee38b65156605a447c48e9e5e26f3336ee6187 - Sigstore transparency entry: 1940584500
- Sigstore integration time:
-
Permalink:
AtarixiaFamine/Moonlygram@9a43c7e506edc70e94f1f7f36befb409c7a1c340 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/AtarixiaFamine
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9a43c7e506edc70e94f1f7f36befb409c7a1c340 -
Trigger Event:
push
-
Statement type:
File details
Details for the file moonlygram-0.1.0-py3-none-any.whl.
File metadata
- Download URL: moonlygram-0.1.0-py3-none-any.whl
- Upload date:
- Size: 59.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62f5ada1948a89710a4abbaa8e92a05741286805db45cb3cb43e9804b09d0612
|
|
| MD5 |
87c62d29704a59e224140d33cdca15f6
|
|
| BLAKE2b-256 |
58abc85f010e01068323269c15e43ecf284978bb22f0bbc53851e4413ea6b14c
|
Provenance
The following attestation bundles were made for moonlygram-0.1.0-py3-none-any.whl:
Publisher:
release.yml on AtarixiaFamine/Moonlygram
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
moonlygram-0.1.0-py3-none-any.whl -
Subject digest:
62f5ada1948a89710a4abbaa8e92a05741286805db45cb3cb43e9804b09d0612 - Sigstore transparency entry: 1940584579
- Sigstore integration time:
-
Permalink:
AtarixiaFamine/Moonlygram@9a43c7e506edc70e94f1f7f36befb409c7a1c340 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/AtarixiaFamine
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9a43c7e506edc70e94f1f7f36befb409c7a1c340 -
Trigger Event:
push
-
Statement type: