Path: blob/master/bot/core/handlers.py
1631 views
from pyrogram.filters import command, regex1from pyrogram.handlers import MessageHandler, CallbackQueryHandler, EditedMessageHandler23from ..modules import *4from ..helper.telegram_helper.bot_commands import BotCommands5from ..helper.telegram_helper.filters import CustomFilters6from .telegram_manager import TgClient789def add_handlers():10TgClient.bot.add_handler(11MessageHandler(12authorize,13filters=command(BotCommands.AuthorizeCommand, case_sensitive=True)14& CustomFilters.sudo,15)16)17TgClient.bot.add_handler(18MessageHandler(19unauthorize,20filters=command(BotCommands.UnAuthorizeCommand, case_sensitive=True)21& CustomFilters.sudo,22)23)24TgClient.bot.add_handler(25MessageHandler(26add_sudo,27filters=command(BotCommands.AddSudoCommand, case_sensitive=True)28& CustomFilters.owner,29)30)31TgClient.bot.add_handler(32MessageHandler(33remove_sudo,34filters=command(BotCommands.RmSudoCommand, case_sensitive=True)35& CustomFilters.owner,36)37)38TgClient.bot.add_handler(39MessageHandler(40send_bot_settings,41filters=command(BotCommands.BotSetCommand, case_sensitive=True)42& CustomFilters.sudo,43)44)45TgClient.bot.add_handler(46CallbackQueryHandler(47edit_bot_settings, filters=regex("^botset") & CustomFilters.sudo48)49)50TgClient.bot.add_handler(51MessageHandler(52cancel,53filters=command(BotCommands.CancelTaskCommand, case_sensitive=True)54& CustomFilters.authorized,55)56)57TgClient.bot.add_handler(58MessageHandler(59cancel_all_buttons,60filters=command(BotCommands.CancelAllCommand, case_sensitive=True)61& CustomFilters.authorized,62)63)64TgClient.bot.add_handler(65CallbackQueryHandler(cancel_all_update, filters=regex("^canall"))66)67TgClient.bot.add_handler(68CallbackQueryHandler(cancel_multi, filters=regex("^stopm"))69)70TgClient.bot.add_handler(71MessageHandler(72clone_node,73filters=command(BotCommands.CloneCommand, case_sensitive=True)74& CustomFilters.authorized,75)76)77TgClient.bot.add_handler(78MessageHandler(79aioexecute,80filters=command(BotCommands.AExecCommand, case_sensitive=True)81& CustomFilters.owner,82)83)84TgClient.bot.add_handler(85MessageHandler(86execute,87filters=command(BotCommands.ExecCommand, case_sensitive=True)88& CustomFilters.owner,89)90)91TgClient.bot.add_handler(92MessageHandler(93clear,94filters=command(BotCommands.ClearLocalsCommand, case_sensitive=True)95& CustomFilters.owner,96)97)98TgClient.bot.add_handler(99MessageHandler(100select,101filters=command(BotCommands.SelectCommand, case_sensitive=True)102& CustomFilters.authorized,103)104)105TgClient.bot.add_handler(106CallbackQueryHandler(confirm_selection, filters=regex("^sel"))107)108TgClient.bot.add_handler(109MessageHandler(110remove_from_queue,111filters=command(BotCommands.ForceStartCommand, case_sensitive=True)112& CustomFilters.authorized,113)114)115TgClient.bot.add_handler(116MessageHandler(117count_node,118filters=command(BotCommands.CountCommand, case_sensitive=True)119& CustomFilters.authorized,120)121)122TgClient.bot.add_handler(123MessageHandler(124delete_file,125filters=command(BotCommands.DeleteCommand, case_sensitive=True)126& CustomFilters.authorized,127)128)129TgClient.bot.add_handler(130MessageHandler(131gdrive_search,132filters=command(BotCommands.ListCommand, case_sensitive=True)133& CustomFilters.authorized,134)135)136TgClient.bot.add_handler(137CallbackQueryHandler(select_type, filters=regex("^list_types"))138)139TgClient.bot.add_handler(CallbackQueryHandler(arg_usage, filters=regex("^help")))140TgClient.bot.add_handler(141MessageHandler(142mirror,143filters=command(BotCommands.MirrorCommand, case_sensitive=True)144& CustomFilters.authorized,145)146)147TgClient.bot.add_handler(148MessageHandler(149qb_mirror,150filters=command(BotCommands.QbMirrorCommand, case_sensitive=True)151& CustomFilters.authorized,152)153)154TgClient.bot.add_handler(155MessageHandler(156jd_mirror,157filters=command(BotCommands.JdMirrorCommand, case_sensitive=True)158& CustomFilters.authorized,159)160)161TgClient.bot.add_handler(162MessageHandler(163nzb_mirror,164filters=command(BotCommands.NzbMirrorCommand, case_sensitive=True)165& CustomFilters.authorized,166)167)168TgClient.bot.add_handler(169MessageHandler(170leech,171filters=command(BotCommands.LeechCommand, case_sensitive=True)172& CustomFilters.authorized,173)174)175TgClient.bot.add_handler(176MessageHandler(177qb_leech,178filters=command(BotCommands.QbLeechCommand, case_sensitive=True)179& CustomFilters.authorized,180)181)182TgClient.bot.add_handler(183MessageHandler(184jd_leech,185filters=command(BotCommands.JdLeechCommand, case_sensitive=True)186& CustomFilters.authorized,187)188)189TgClient.bot.add_handler(190MessageHandler(191nzb_leech,192filters=command(BotCommands.NzbLeechCommand, case_sensitive=True)193& CustomFilters.authorized,194)195)196TgClient.bot.add_handler(197MessageHandler(198get_rss_menu,199filters=command(BotCommands.RssCommand, case_sensitive=True)200& CustomFilters.authorized,201)202)203TgClient.bot.add_handler(CallbackQueryHandler(rss_listener, filters=regex("^rss")))204TgClient.bot.add_handler(205MessageHandler(206run_shell,207filters=command(BotCommands.ShellCommand, case_sensitive=True)208& CustomFilters.owner,209)210)211TgClient.bot.add_handler(212EditedMessageHandler(213run_shell,214filters=command(BotCommands.ShellCommand, case_sensitive=True)215& CustomFilters.owner,216)217)218TgClient.bot.add_handler(219MessageHandler(220start, filters=command(BotCommands.StartCommand, case_sensitive=True)221)222)223TgClient.bot.add_handler(224MessageHandler(225log,226filters=command(BotCommands.LogCommand, case_sensitive=True)227& CustomFilters.sudo,228)229)230TgClient.bot.add_handler(231MessageHandler(232restart_bot,233filters=command(BotCommands.RestartCommand, case_sensitive=True)234& CustomFilters.sudo,235)236)237TgClient.bot.add_handler(238CallbackQueryHandler(239confirm_restart, filters=regex("^botrestart") & CustomFilters.sudo240)241)242TgClient.bot.add_handler(243MessageHandler(244ping,245filters=command(BotCommands.PingCommand, case_sensitive=True)246& CustomFilters.authorized,247)248)249TgClient.bot.add_handler(250MessageHandler(251bot_help,252filters=command(BotCommands.HelpCommand, case_sensitive=True)253& CustomFilters.authorized,254)255)256TgClient.bot.add_handler(257MessageHandler(258bot_stats,259filters=command(BotCommands.StatsCommand, case_sensitive=True)260& CustomFilters.authorized,261)262)263TgClient.bot.add_handler(264MessageHandler(265task_status,266filters=command(BotCommands.StatusCommand, case_sensitive=True)267& CustomFilters.authorized,268)269)270TgClient.bot.add_handler(271CallbackQueryHandler(status_pages, filters=regex("^status"))272)273TgClient.bot.add_handler(274MessageHandler(275torrent_search,276filters=command(BotCommands.SearchCommand, case_sensitive=True)277& CustomFilters.authorized,278)279)280TgClient.bot.add_handler(281CallbackQueryHandler(torrent_search_update, filters=regex("^torser"))282)283TgClient.bot.add_handler(284MessageHandler(285get_users_settings,286filters=command(BotCommands.UsersCommand, case_sensitive=True)287& CustomFilters.sudo,288)289)290TgClient.bot.add_handler(291MessageHandler(292send_user_settings,293filters=command(BotCommands.UserSetCommand, case_sensitive=True)294& CustomFilters.authorized,295)296)297TgClient.bot.add_handler(298CallbackQueryHandler(edit_user_settings, filters=regex("^userset"))299)300TgClient.bot.add_handler(301MessageHandler(302ytdl,303filters=command(BotCommands.YtdlCommand, case_sensitive=True)304& CustomFilters.authorized,305)306)307TgClient.bot.add_handler(308MessageHandler(309ytdl_leech,310filters=command(BotCommands.YtdlLeechCommand, case_sensitive=True)311& CustomFilters.authorized,312)313)314TgClient.bot.add_handler(315MessageHandler(316hydra_search,317filters=command(BotCommands.NzbSearchCommand, case_sensitive=True)318& CustomFilters.authorized,319)320)321322323