One Python Framework for Telegram Bots and Userbots
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
shirdalwithpipand start building bots or userbots right away — zero required external HTTP or crypto dependencies. - Hybrid: Run on
BotAPIAdapterfor inline buttons and webhooks whileHybridAdapterautomatically routes files> 50 MiBthroughNativeMTProtoAdapter. - Fast: Boosted by
shircrypt, a memory-safe Rust crypto extension (4.67x faster on average thanTgCrypto, up to 11.84x on AES-CTR) with optionaluvloopandmsgspec. - Modern: Modular
Routers, zero-dependency magic filterF,StatesGroupFSM with Redis/SQLite TTL, and one-lineawait ctx.ask()conversations. - Type-hinted: Fully typed
Context, filters, adapters, andpy.typedmarker for first-class IDE autocomplete andmypy/pyrightsupport. - Resilient: Built-in
AntiFloodAdapter, hot-reloadable plugins,@bot.every()scheduler, and offline testing withMockAdapter.
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
Metadata
Release files for shirdal 1.0.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| shirdal-1.0.14.tar.gz | 600.5 kB | With provenance | Details for shirdal-1.0.14.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| shirdal-1.0.14-py3-none-any.whl | Python 3 | none | any | Details for shirdal-1.0.14-py3-none-any.whl |
Total release size: 777.2 kB
Release files / shirdal-1.0.14.tar.gz
| Download URL | shirdal-1.0.14.tar.gz |
|---|---|
| Size | 600.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a4609ad9ef688c3397d3d7525ea49e7a63a1ade901f46328297c20f05f3f3f4f
|
|
BLAKE2b-256 checksum How to use checksums |
e45b7f7c7aa577a4daa836d418d3c0433e91b78a76cf6b53c217c23f8dcd7e94
|
| 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 logRelease files / shirdal-1.0.14-py3-none-any.whl
| Download URL | shirdal-1.0.14-py3-none-any.whl |
|---|---|
| Size | 176.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c53dfaa84419f1ab73192c7c1df316340f58aed107be7d6e67d0bc8fbb825e46
|
|
BLAKE2b-256 checksum How to use checksums |
8a2d57f2113b8673fcb7abeec298600b98c9d2758c8f95e0f302cee96d06da87
|
| 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 logSecurity for shirdal 1.0.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for shirdal-1.0.14.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 logA 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.