Other Handlers
In addition to command handlers, you also need to know how to create your own handlers.
Handlers can be created in the usual way, just make sure to specify the group for the module group.
Documentation on handlers in Pyrogram
Where to get the module group?
Either use mod.group (default group) or create a new one: mod.get_group()
Examples
AdRimTUB/__init__.py
from utils import *
from pyrogram import filters
ad_text = f"""
{b('🚀 RimTUB — an advanced userbot for Telegram!')}
🔹 Flexible module system: easily add and configure new features.
🔹 Open source: security and customization options.
🔹 Simple installation: set up in minutes and start using!
Join the community and unlock new possibilities in Telegram!
🔗 {b('GitHub')} {a('github.com/RimTUB/RimTUB', 'https://github.com/RimTUB/RimTUB')}
📢 {b('Channel')} @RimTUB
"""
async def main(app: Client, mod: Module):
@app.on_message(
filters.text & ~filters.me & text_filter("#RimTUB"),
group=mod.get_group()
)
async def _RimTUB(_, msg):
await msg.reply(ad_text, quote=True)
info
The following example is taken from the MineEvoMiner module (version 2.5) by a third-party developer @Kotcananacom
warning
This example was written for RimTUB 2.1, so the HelpList in this example is outdated!
MineEvoMiner/__init__.py
from utils import *
from .miner import *
from .stats.stat import *
from .helplist import module_help # Note! RimTUB 2.2 uses a different HelpList system!
async def main(app: Client, mod: Module):
cmd = mod.cmd
module_help(mod) # Note! RimTUB 2.2 uses a different HelpList system!
@mod.on_ready
async def _onr(app): await stats_ready(app, mod)
@cmd('mbc')
async def _mbc(*args): await beautiful_case_found(*args, mod)
@app.on_message(filters.chat(mine_bots_us) & ~filters.me, group=mod.get_group())
async def _found_cases(*args): await found_cases(*args, mod)
@app.on_message(filters.chat(list(mine_bots.values())) & filters.text & ~filters.me, group=mod.get_group())
async def _count_clicks(*args): await count_clicks(*args, mod)
@app.on_message(filters.chat(mine_bots_us) & filters.text & ~filters.me, group=mod.get_group())
async def _count_plasma(*args): await plasma_count(*args, mod)
...