Skip to main content

An async Telegram Bot API client with built-in rich-message support.

Project description

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

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.2 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.

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

moonlygram-0.4.0.tar.gz (486.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

moonlygram-0.4.0-py3-none-any.whl (74.6 kB view details)

Uploaded Python 3

File details

Details for the file moonlygram-0.4.0.tar.gz.

File metadata

  • Download URL: moonlygram-0.4.0.tar.gz
  • Upload date:
  • Size: 486.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for moonlygram-0.4.0.tar.gz
Algorithm Hash digest
SHA256 3c3e34111189492f0f2370d93f972fb0a15657ccc5f67ec8a3f2f59abf0d2b57
MD5 95485aef4405a1e01311a432d384bec0
BLAKE2b-256 76a8b78f22b234681ed00218085826827d60ba8ec73f3886183d71604f5cc6e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for moonlygram-0.4.0.tar.gz:

Publisher: release.yml on AtarixiaFamine/Moonlygram

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file moonlygram-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: moonlygram-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 74.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for moonlygram-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a0bd9324e1002840708b8c51898f1f32c33d4f188d7a28985b48024d9f88743f
MD5 35a9ad86926f7867a5461c3b3fb50166
BLAKE2b-256 4575c176f3ac905dec1c8a85359010c57a90866fdfadc7b6ed156cba30b8a1f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for moonlygram-0.4.0-py3-none-any.whl:

Publisher: release.yml on AtarixiaFamine/Moonlygram

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page