Skip to main content

hydragram

Hydragram is an enhanced filter and handler system inspired by Pyrogram, built on top of pyrogram.

It helps you avoid common Pyrogram errors—especially those related to using group={} in command handlers—by providing a simple and stable way to register commands and filters.

With Hydragram, you no longer need to manually manage the group parameter or worry about filter conflicts. It handles all that smoothly for you, so your commands work reliably every time.

Simplify your Telegram bot development and enjoy clean, easy-to-use decorators and filters designed for real-world use.

Testing Bot

Yumeko That is running on telegram by the last code of that Readme check it out

Toji That is running on telegram with Another repo where this package used check it also

Installation

pip install hydragram

How to use it

from hydragram.client import Client
from hydragram.handler import handler
from hydragram.filters import command, group

client = Client("mybot", api_id=12345, api_hash="xyz", bot_token="TOKEN")

@handler("start")
async def start(client, message):
    await message.reply_text("Hello!")

# <======== YOU CAN ALSO USE IT IN ANOTHER WAY =====>
@client.on_message(filters.command("start"))
async def start(client, message):
    await message.reply_text("Hello this is second way!")

client.run()

Example How to use them

from hydragram import Client
from hydragram.filters import setup 
from hydragram.handler import handler
from hydragram.filters import group, private
from pyrogram.types import Message

app = Client(
    "TestBot",
    api_id=You_Api_Id, # generate it from my.telegram.org
    api_hash="Your_Api_hash", # generate it from my.telegram.org
    bot_token="Your_Bot_Token" # Get from @BotFather
)

# Initialize with your settings
setup(
    OWNER_ID=6346273488,  # Replace Your user ID and generate from @Raiden_Robot
    DEV_USERS=[8171988347, 5907205317],  # Your dev team Id and generate Their I'd from @Raiden_Robot
    PREFIX_HANDLER=["/", "!" "Raiden ", "raiden "],  # Command prefixes
    BOT_USERNAME="@Raiden_Robot"  # Your bot's username
)

# Regular command (anyone can use)
@handler("start", extra=private)
async def start_handler(_, m: Message):
    await m.reply("Hello! I'm alive ✅")

# Group command
@handler("alive", extra=group)
async def alive(_, m: Message):
    await m.reply("Bot is working fine in group!")

# Owner-only command
@handler("owner", owner_cmd=True)
async def owner_command(_, m: Message):
    await m.reply("👑 This is an owner-only command!")

# Developer-only command
@handler("dev", dev_cmd=True)
async def dev_command(_, m: Message):
    await m.reply("💻 This is a developer-only command!")

# Group owner-only command
@handler("gowner", gc_owner=True)
async def group_owner_command(_, m: Message):
    await m.reply("🏘️ This command can only be used by group owners!")

# Group admin-only command (includes owner)
@handler("gadmin", gc_admin=True)
async def group_admin_command(_, m: Message):
    await m.reply("🛡️ This command can only be used by group admins!")

# Combined permission example
@handler("power", dev_cmd=True, gc_admin=True)
async def power_command(_, m: Message):
    await m.reply("⚡ This command requires either dev rights or group admin!")

if __name__ == "__main__":
    app.run()

🤝 Contributing

Contributions are welcome! If you have suggestions, improvements, or bug fixes, feel free to fork the repository and submit a pull request.

Created By hasnainkk-07

Metadata

Release files for hydragram 3.2.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 hydragram 3.2.0
File Size Uploaded Provenance
hydragram-3.2.0.tar.gz 20.2 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 39.6 kB

Release files / hydragram-3.2.0.tar.gz

Download URL hydragram-3.2.0.tar.gz
Size 20.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ccc68b91f100477c1368f5ae1ca58d2ce0bab44039984141d0c4d5c0175de249
BLAKE2b-256 checksum
How to use checksums
8884dda8e9bc50e81fc38b515238572f519124405d79e81c8c28fc999cc82e78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.18

Release files / hydragram-3.2.0-py3-none-any.whl

Download URL hydragram-3.2.0-py3-none-any.whl
Size 19.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d93bb9a0ebed8abdf96b5cdb79c2cc9d0b2b128b1be69bb555e01d2f9783b0c7
BLAKE2b-256 checksum
How to use checksums
2a8eb12120b8e489ce4924ee36aac8e1a0c9f98fc479be0306761742bd919e5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.18

Security for hydragram 3.2.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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