Skip to main content

Moonlygram Logo

Moonlygram

A modern, async Python framework for the Telegram Bot API, with built-in rich messages.
Pure HTTP. No MTProto. No native dependencies.

PyPI Python versions mypy strict Bot API 10.3 License


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.3).

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 rich messages (headings, tables, collapsibles, math) with a composable, auto-escaping builder, convert Markdown in one call, or build them from Bot API 10.3 structured blocks. No other library has this.
  • Type-hinted: ships py.typed and passes mypy --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, no api_id/api_hash, and no C extensions.
  • Batteries included: conversations, persistence, scheduled jobs, arbitrary callback data, and both polling and webhooks.

Resources

Roadmap

Core messaging, media, chat and member administration, bot configuration, forum topics, stickers, inline mode, and payments / Telegram Stars are all covered, and every modelled method accepts every parameter the Bot API defines for it (a drift test enforces this against the vendored spec). Still in progress: the niche Bot API domains of business accounts, games, gifts and stories, checklists, and passport / 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.

Release files for moonlygram 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for moonlygram 1.3.0
File Size Uploaded
moonlygram-1.3.0.tar.gz 508.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for moonlygram 1.3.0
File Interpreter ABI Platform
moonlygram-1.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 589.5 kB

Release files / moonlygram-1.3.0.tar.gz

Download URL moonlygram-1.3.0.tar.gz
Size 508.0 kB
Tags Source
SHA-256 checksum
How to use checksums
81f89dc14ddc221ab965c22d215afd6d4fc69316abbfc4135367f6e0f28ccd72
BLAKE2b-256 checksum
How to use checksums
dde539853b7a894baabd999508696f9d8090118fde846f81a0994c7f4ee31be3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.

Transparency log

Release files / moonlygram-1.3.0-py3-none-any.whl

Download URL moonlygram-1.3.0-py3-none-any.whl
Size 81.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
38fa80648c081332b927585496027c74366c955cb32d7b53e7cb0feb7c318906
BLAKE2b-256 checksum
How to use checksums
7d532bee9d369b78078a2e05ffd80b506d9f16704890e7cfb0a61f672866808b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.

Transparency log

Release history Release notifications | RSS feed

1.3.1

2 release files

This release

1.3.0 This release

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page