Skip to main content
Shirdal Logo

One Python Framework for Telegram Bots and Userbots

Documentation • Benchmarks • Download Docs (.md) • فارسی

CI PyPI Python Crypto License: LGPL v3


Shirdal

Modern, context-first asynchronous framework for Telegram Bot API 10.5 and Native MTProto 2.0 in Python

Write your handlers once and run them on the Bot API, a Native MTProto 2.0 client, or both at the same time via HybridAdapter — with full support for Bot API 10.5 (colored buttons, custom emoji, rich messages, live draft streaming) and 50MB+ MTProto uploads.

import os
from shirdal import BotAPIAdapter, Context, F, Router, Shirdal

router = Router("main")

@router.on_command("start")
async def start(ctx: Context) -> None:
    reply_ctx = await ctx.ask("What is your name?", timeout=60, filters=F.text)
    await reply_ctx.reply(f"Hello <b>{reply_ctx.text}</b>!")

if __name__ == "__main__":
    bot = Shirdal(BotAPIAdapter(os.environ["BOT_TOKEN"]))
    bot.include_router(router)
    bot.run()

Key Features

  • Ready: Install shirdal with pip and start building bots or userbots right away — zero required external HTTP or crypto dependencies.
  • Hybrid: Run on BotAPIAdapter for inline buttons and webhooks while HybridAdapter automatically routes files > 50 MiB through NativeMTProtoAdapter.
  • Fast: Boosted by shircrypt, a memory-safe Rust crypto extension (4.67x faster on average than TgCrypto, up to 11.84x on AES-CTR) with optional uvloop and msgspec.
  • Modern: Modular Routers, zero-dependency magic filter F, StatesGroup FSM with Redis/SQLite TTL, and one-line await ctx.ask() conversations.
  • Type-hinted: Fully typed Context, filters, adapters, and py.typed marker for first-class IDE autocomplete and mypy/pyright support.
  • Resilient: Built-in AntiFloodAdapter, hot-reloadable plugins, @bot.every() scheduler, and offline testing with MockAdapter.

Installing

Stable version

pip install shirdal

Dev version

pip install git+https://github.com/Vicious-Cycle/shirdal.git

Optional dependencies

pip install "shirdal[fast]"       # uvloop + msgspec + shircrypt (4.67x faster crypto)
pip install "shirdal[shircrypt]"  # Rust-accelerated AES-IGE / CTR / KDF
pip install "shirdal[redis]"      # Distributed Redis FSM & chat cache
pip install "shirdal[telethon]"   # Telethon adapter

Resources

  • Check out the Documentation for full guides, HybridAdapter, FSM, and auto-generated API Reference.
  • Download the Full Docs (.md) for offline reading or AI assistants.
  • Explore shircrypt for Rust MTProto 2.0 cryptography benchmarks.
  • Contributions and security reports are welcome — see CONTRIBUTING.md and SECURITY.md.

License

LGPL-3.0-or-later

Metadata

Release files for shirdal 1.0.15

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

Source distribution (sdist)

Source distribution for shirdal 1.0.15
File Size Uploaded Provenance Actions
shirdal-1.0.15.tar.gz 600.6 kB With provenance Details for shirdal-1.0.15.tar.gz

Built distribution (wheel)

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

Total release size: 777.3 kB

Release files / shirdal-1.0.15.tar.gz

Download URL shirdal-1.0.15.tar.gz
Size 600.6 kB
Tags Source
SHA-256 checksum
How to use checksums
508420452cf0cdd2721b65f4d273fe2891fc0cf9f7be71d3546d2d8787f3d90f
BLAKE2b-256 checksum
How to use checksums
65b079418726555a6ea6bd43c37055c78ec3d528dc7080d237e47714efa24c03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 26, 2026.

Transparency log

Release files / shirdal-1.0.15-py3-none-any.whl

Download URL shirdal-1.0.15-py3-none-any.whl
Size 176.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
83f8f52a68602982ac53b7ac8a4e86ee7fcdc41849c4a7fcc01f3445dee0eb82
BLAKE2b-256 checksum
How to use checksums
aa753bab8f118cb696156835ad20cb4cf7b30cb4cf64d744f26a40d4201a0184
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 26, 2026.

Transparency log

Security for shirdal 1.0.15

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for shirdal-1.0.15.tar.gz

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 Nov 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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