""" __mod_name__ = "Filters 📃" FILTER_HANDLER = CommandHandler("filter", filters) STOP_HANDLER = CommandHandler("stop", stop_filter) RMALLFILTER_HANDLER = CommandHandler("removeallfilters", rmall_filters, filters=Filters.group) RMALLFILTER_CALLBACK = CallbackQueryHandler(rmall_callback, pattern=r"filters_.*") LIST_HANDLER = DisableAbleCommandHandler("filters", list_handlers, admin_ok=True) CUST_FILTER_HANDLER = MessageHandler( CustomFilters.has_text & ~Filters.update.edited_message, reply_filter) dispatcher.add_handler(FILTER_HANDLER) dispatcher.add_handler(STOP_HANDLER) dispatcher.add_handler(LIST_HANDLER) dispatcher.add_handler(CUST_FILTER_HANDLER, HANDLER_GROUP) dispatcher.add_handler(RMALLFILTER_HANDLER) dispatcher.add_handler(RMALLFILTER_CALLBACK) __handlers__ = [ FILTER_HANDLER, STOP_HANDLER, LIST_HANDLER, (CUST_FILTER_HANDLER, HANDLER_GROUP, RMALLFILTER_HANDLER), ]
RESET_WARN_HANDLER = CommandHandler( ["resetwarn", "resetwarns"], reset_warns, filters=Filters.group ) CALLBACK_QUERY_HANDLER = CallbackQueryHandler(button, pattern=r"rm_warn") MYWARNS_HANDLER = DisableAbleCommandHandler("warns", warns, filters=Filters.group) ADD_WARN_HANDLER = CommandHandler("addwarn", add_warn_filter, filters=Filters.group) RM_WARN_HANDLER = CommandHandler( ["nowarn", "stopwarn"], remove_warn_filter, filters=Filters.group ) LIST_WARN_HANDLER = DisableAbleCommandHandler( ["warnlist", "warnfilters"], list_warn_filters, filters=Filters.group, admin_ok=True ) WARN_FILTER_HANDLER = MessageHandler( CustomFilters.has_text & Filters.group, reply_filter ) WARN_LIMIT_HANDLER = CommandHandler("warnlimit", set_warn_limit, filters=Filters.group) WARN_STRENGTH_HANDLER = CommandHandler( "strongwarn", set_warn_strength, filters=Filters.group ) dispatcher.add_handler(WARN_HANDLER) dispatcher.add_handler(CALLBACK_QUERY_HANDLER) dispatcher.add_handler(RESET_WARN_HANDLER) dispatcher.add_handler(MYWARNS_HANDLER) dispatcher.add_handler(ADD_WARN_HANDLER) dispatcher.add_handler(RM_WARN_HANDLER) dispatcher.add_handler(LIST_WARN_HANDLER) dispatcher.add_handler(WARN_LIMIT_HANDLER) dispatcher.add_handler(WARN_STRENGTH_HANDLER) dispatcher.add_handler(WARN_FILTER_HANDLER, WARN_HANDLER_GROUP)
return """╘══「 Groups count: <code>???</code> 」""" num_chats = sql.get_user_num_chats(user_id) return f"""╘══「 Groups count: <code>{num_chats}</code> 」""" def __stats__(): return f"• {sql.num_users()} users, across {sql.num_chats()} chats" def __migrate__(old_chat_id, new_chat_id): sql.migrate_chat(old_chat_id, new_chat_id) __help__ = "" # no help string BROADCAST_HANDLER = CommandHandler( ["broadcastall", "broadcastusers", "broadcastgroups"], broadcast) USER_HANDLER = MessageHandler(Filters.all & Filters.group, log_user) CHAT_CHECKER_HANDLER = MessageHandler(Filters.all & Filters.group, chat_checker) CHATLIST_HANDLER = CommandHandler("groups", chats) dispatcher.add_handler(USER_HANDLER, USERS_GROUP) dispatcher.add_handler(BROADCAST_HANDLER) dispatcher.add_handler(CHATLIST_HANDLER) dispatcher.add_handler(CHAT_CHECKER_HANDLER, CHAT_GROUP) __mod_name__ = "Users" __handlers__ = [(USER_HANDLER, USERS_GROUP), BROADCAST_HANDLER, CHATLIST_HANDLER]
SANITIZE_HANDLER = DisableAbleCommandHandler("sanitize", sanitize) RUNS_HANDLER = DisableAbleCommandHandler("runs", runs) SLAP_HANDLER = DisableAbleCommandHandler("slap", slap) PAT_HANDLER = DisableAbleCommandHandler("pat", pat) ROLL_HANDLER = DisableAbleCommandHandler("roll", roll) TOSS_HANDLER = DisableAbleCommandHandler("toss", toss) SHRUG_HANDLER = DisableAbleCommandHandler("shrug", shrug) BLUETEXT_HANDLER = DisableAbleCommandHandler("bluetext", bluetext) RLG_HANDLER = DisableAbleCommandHandler("rlg", rlg) DECIDE_HANDLER = DisableAbleCommandHandler("decide", decide) TABLE_HANDLER = DisableAbleCommandHandler("table", table) SHOUT_HANDLER = DisableAbleCommandHandler("shout", shout) WEEBIFY_HANDLER = DisableAbleCommandHandler("weebify", weebify) dispatcher.add_handler(WEEBIFY_HANDLER) dispatcher.add_handler(SHOUT_HANDLER) dispatcher.add_handler(SANITIZE_HANDLER) dispatcher.add_handler(RUNS_HANDLER) dispatcher.add_handler(SLAP_HANDLER) dispatcher.add_handler(PAT_HANDLER) dispatcher.add_handler(ROLL_HANDLER) dispatcher.add_handler(TOSS_HANDLER) dispatcher.add_handler(SHRUG_HANDLER) dispatcher.add_handler(BLUETEXT_HANDLER) dispatcher.add_handler(RLG_HANDLER) dispatcher.add_handler(DECIDE_HANDLER) dispatcher.add_handler(TABLE_HANDLER) __mod_name__ = "Fun 😜" __command_list__ = [
WHITELIST_HANDLER = CommandHandler(("addwhitelist", "addwolf"), addwhitelist) UNSUDO_HANDLER = CommandHandler(("removesudo", "removedragon"), removesudo) UNSUPPORT_HANDLER = CommandHandler(("removesupport", "removedemon"), removesupport) UNTIGER_HANDLER = CommandHandler(("removetiger"), removetiger) UNWHITELIST_HANDLER = CommandHandler(("removewhitelist", "removewolf"), removewhitelist) WHITELISTLIST_HANDLER = CommandHandler(["whitelistlist", "wolves"], whitelistlist) TIGERLIST_HANDLER = CommandHandler(["tigers"], tigerlist) SUPPORTLIST_HANDLER = CommandHandler(["supportlist", "demons"], supportlist) SUDOLIST_HANDLER = CommandHandler(["sudolist", "dragons"], sudolist) DEVLIST_HANDLER = CommandHandler(["devlist", "renters"], devlist) dispatcher.add_handler(SUDO_HANDLER) dispatcher.add_handler(SUPPORT_HANDLER) dispatcher.add_handler(TIGER_HANDLER) dispatcher.add_handler(WHITELIST_HANDLER) dispatcher.add_handler(UNSUDO_HANDLER) dispatcher.add_handler(UNSUPPORT_HANDLER) dispatcher.add_handler(UNTIGER_HANDLER) dispatcher.add_handler(UNWHITELIST_HANDLER) dispatcher.add_handler(WHITELISTLIST_HANDLER) dispatcher.add_handler(TIGERLIST_HANDLER) dispatcher.add_handler(SUPPORTLIST_HANDLER) dispatcher.add_handler(SUDOLIST_HANDLER) dispatcher.add_handler(DEVLIST_HANDLER) __mod_name__ = "Disasters 💣"
) response = requests.get(request_url).json() try: current_rate = float( response["Realtime Currency Exchange Rate"]["5. Exchange Rate"] ) except KeyError: update.effective_message.reply_text("Currency Not Supported.") return new_cur_amount = round(orig_cur_amount * current_rate, 5) update.effective_message.reply_text( f"{orig_cur_amount} {orig_cur} = {new_cur_amount} {new_cur}" ) elif len(args) == 1: update.effective_message.reply_text(__help__, parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text( f"*Invalid Args!!:* Required 3 But Passed {len(args) -1}", parse_mode=ParseMode.MARKDOWN, ) CONVERTER_HANDLER = CommandHandler("cash", convert) dispatcher.add_handler(CONVERTER_HANDLER) __command_list__ = ["cash"] __handlers__ = [CONVERTER_HANDLER]
msg.reply_text(f"An error occurred! Report this @{SUPPORT_CHAT}") else: wallpapers = json_rep.get("wallpapers") if not wallpapers: msg.reply_text("No results found! Refine your search.") return else: index = randint(0, len(wallpapers) - 1) # Choose random index wallpaper = wallpapers[index] wallpaper = wallpaper.get("url_image") wallpaper = wallpaper.replace("\\", "") bot.send_photo( chat_id, photo=wallpaper, caption="Preview", reply_to_message_id=msg_id, timeout=60, ) bot.send_document( chat_id, document=wallpaper, filename="wallpaper", caption=caption, reply_to_message_id=msg_id, timeout=60, ) WALLPAPER_HANDLER = DisableAbleCommandHandler("wall", wall) dispatcher.add_handler(WALLPAPER_HANDLER)
"(「• ω •)「", "( ˘ ɜ˘) ♬♪♫", "( o˘◡˘o) ┌iii┐", "♨o(>_<)o♨", "( ・・)つ―{}@{}@{}-", "(*´з`)口゚。゚口(・∀・ )", "( *^^)o∀*∀o(^^* )", "-●●●-c(・・ )", "(ノ≧∀≦)ノ ‥…━━━★", "╰( ͡° ͜ʖ ͡° )つ──☆*:・゚", "(∩ᄑ_ᄑ)⊃━☆゚*・。*・:≡( ε:)", ] @run_async def react(update: Update, context: CallbackContext): message = update.effective_message react = random.choice(reactions) if message.reply_to_message: message.reply_to_message.reply_text(react) else: message.reply_text(react) REACT_HANDLER = DisableAbleCommandHandler("react", react) dispatcher.add_handler(REACT_HANDLER) __command_list__ = ["react"] __handlers__ = [REACT_HANDLER]
"Disambiguated pages found! Adjust your query accordingly.\n<i>{}</i>" .format(e), parse_mode=ParseMode.HTML, ) except PageError as e: update.message.reply_text("<code>{}</code>".format(e), parse_mode=ParseMode.HTML) if res: result = f"<b>{search}</b>\n\n" result += f"<i>{res}</i>\n" result += f"""<a href="https://en.wikipedia.org/wiki/{search.replace(" ", "%20")}">Read more...</a>""" if len(result) > 4000: with open("result.txt", "w") as f: f.write(f"{result}\n\nUwU OwO OmO UmU") with open("result.txt", "rb") as f: context.bot.send_document( document=f, filename=f.name, reply_to_message_id=update.message.message_id, chat_id=update.effective_chat.id, parse_mode=ParseMode.HTML, ) else: update.message.reply_text(result, parse_mode=ParseMode.HTML, disable_web_page_preview=True) WIKI_HANDLER = DisableAbleCommandHandler("wiki", wiki) dispatcher.add_handler(WIKI_HANDLER)
def main(): if SUPPORT_CHAT is not None and isinstance(SUPPORT_CHAT, str): try: dispatcher.bot.sendMessage(f"@{SUPPORT_CHAT}", "I am now online!") except Unauthorized: LOGGER.warning( "Bot isnt able to send message to support_chat, go and check!") except BadRequest as e: LOGGER.warning(e.message) CommandHandler("test", test) start_handler = CommandHandler("start", start) help_handler = CommandHandler("help", get_help) help_callback_handler = CallbackQueryHandler(help_button, pattern=r"help_.*") settings_handler = CommandHandler("settings", get_settings) settings_callback_handler = CallbackQueryHandler(settings_button, pattern=r"stngs_") donate_handler = CommandHandler("donate", donate) migrate_handler = MessageHandler(Filters.status_update.migrate, migrate_chats) # dispatcher.add_handler(test_handler) dispatcher.add_handler(start_handler) dispatcher.add_handler(help_handler) dispatcher.add_handler(settings_handler) dispatcher.add_handler(help_callback_handler) dispatcher.add_handler(settings_callback_handler) dispatcher.add_handler(migrate_handler) dispatcher.add_handler(donate_handler) dispatcher.add_error_handler(error_callback) if WEBHOOK: LOGGER.info("Using webhooks.") updater.start_webhook(listen="0.0.0.0", port=PORT, url_path=TOKEN) if CERT_PATH: updater.bot.set_webhook(url=URL + TOKEN, certificate=open(CERT_PATH, "rb")) else: updater.bot.set_webhook(url=URL + TOKEN) else: LOGGER.info("Using long polling.") updater.start_polling(timeout=15, read_latency=4, clean=True) if len(argv) not in (1, 3, 4): telethn.disconnect() else: telethn.run_until_disconnected() updater.idle()
__help__ = """ *Admins only:* • /logchannel *:* get log channel info • /setlog *:* set the log channel. • /unsetlog *:* unset the log channel. Setting the log channel is done by: • adding the bot to the desired channel (as an admin!) • sending `/setlog` in the channel • forwarding the `/setlog` to the group """ __mod_name__ = "Logger 🏷" LOG_HANDLER = CommandHandler("logchannel", logging) SET_LOG_HANDLER = CommandHandler("setlog", setlog) UNSET_LOG_HANDLER = CommandHandler("unsetlog", unsetlog) dispatcher.add_handler(LOG_HANDLER) dispatcher.add_handler(SET_LOG_HANDLER) dispatcher.add_handler(UNSET_LOG_HANDLER) else: # run anyway if module not loaded def loggable(func): return func def gloggable(func): return func
if message.reply_to_message: data = message.reply_to_message.text elif len(args) >= 1: data = message.text.split(None, 1)[1] else: message.reply_text("What am I supposed to do with this?") return key = (requests.post("https://nekobin.com/api/documents", json={ "content": data }).json().get("result").get("key")) url = f"https://nekobin.com/{key}" reply_text = f"Text Pasted to *Nekobin*\n\n👉 {url}" message.reply_text(reply_text, parse_mode=ParseMode.MARKDOWN, disable_web_page_preview=True) PASTE_HANDLER = DisableAbleCommandHandler("paste", paste) dispatcher.add_handler(PASTE_HANDLER) __command_list__ = ["paste"] __handlers__ = [PASTE_HANDLER]
return if success: msg.reply_text( "Sticker pack successfully created. Get it [here](t.me/addstickers/%s)" % packname, parse_mode=ParseMode.MARKDOWN, ) else: msg.reply_text( "Failed to create sticker pack. Possibly due to blek mejik.") __help__ = """ • `/stickerid`*:* reply to a sticker to me to tell you its file ID. • `/getsticker`*:* reply to a sticker to me to upload its raw PNG file. • `/kang`*:* reply to a sticker to add it to your pack. • `/stickers`*:* Find stickers for given term on combot sticker catalogue """ __mod_name__ = "Stickers 🖼" STICKERID_HANDLER = DisableAbleCommandHandler("stickerid", stickerid) GETSTICKER_HANDLER = DisableAbleCommandHandler("getsticker", getsticker) KANG_HANDLER = DisableAbleCommandHandler("kang", kang, admin_ok=True) STICKERS_HANDLER = DisableAbleCommandHandler("stickers", cb_sticker) dispatcher.add_handler(STICKERS_HANDLER) dispatcher.add_handler(STICKERID_HANDLER) dispatcher.add_handler(GETSTICKER_HANDLER) dispatcher.add_handler(KANG_HANDLER)
status = True chat_data[chat_id] = {"backups": {"status": status, "value": value}} def get_chat(chat_id, chat_data): # print(chat_data) try: value = chat_data[chat_id]["backups"] return value except KeyError: return {"status": False, "value": False} __mod_name__ = "Backups 💾" __help__ = """ *Only for group owner:* • /import : Reply to the backup file for the butler / emilia group to import as much as possible, making transfers very easy! \ Note that files / photos cannot be imported due to telegram restrictions. • /export : Export group data, which will be exported are: rules, notes (documents, images, music, video, audio, voice, text, text buttons) \ """ IMPORT_HANDLER = CommandHandler("import", import_data) EXPORT_HANDLER = CommandHandler("export", export_data, pass_chat_data=True) dispatcher.add_handler(IMPORT_HANDLER) dispatcher.add_handler(EXPORT_HANDLER)
return name = bot.get_chat(user).first_name text = f"<b>Common chats with {name}</b>\n" for chat in common_list: try: chat_name = bot.get_chat(chat).title sleep(0.3) text += f"• <code>{chat_name}</code>\n" except BadRequest: pass except Unauthorized: pass except RetryAfter as e: sleep(e.retry_after) if len(text) < 4096: msg.reply_text(text, parse_mode="HTML") else: with open("common_chats.txt", "w") as f: f.write(text) with open("common_chats.txt", "rb") as f: msg.reply_document(f) os.remove("common_chats.txt") COMMON_CHATS_HANDLER = CommandHandler("getchats", get_user_common_chats, filters=Filters.user(OWNER_ID)) dispatcher.add_handler(COMMON_CHATS_HANDLER)
*Only admin:* • /addblsticker `<sticker link>` *:* Add the sticker trigger to the black list. Can be added via reply sticker • /unblsticker `<sticker link>` *:* Remove triggers from blacklist. The same newline logic applies here, so you can delete multiple triggers at once • /rmblsticker `<sticker link>` *:* Same as above • /blstickermode `<ban/tban/mute/tmute>`*:* sets up a default action on what to do if users use blacklisted stickers Note: • `<sticker link>` can be `https://t.me/addstickers/<sticker>` or just `<sticker>` or reply to the sticker message """ __mod_name__ = "Stickers Blacklist" BLACKLIST_STICKER_HANDLER = DisableAbleCommandHandler( "blsticker", blackliststicker, admin_ok=True ) ADDBLACKLIST_STICKER_HANDLER = DisableAbleCommandHandler( "addblsticker", add_blackliststicker ) UNBLACKLIST_STICKER_HANDLER = CommandHandler( ["unblsticker", "rmblsticker"], unblackliststicker ) BLACKLISTMODE_HANDLER = CommandHandler("blstickermode", blacklist_mode) BLACKLIST_STICKER_DEL_HANDLER = MessageHandler( Filters.sticker & Filters.group, del_blackliststicker ) dispatcher.add_handler(BLACKLIST_STICKER_HANDLER) dispatcher.add_handler(ADDBLACKLIST_STICKER_HANDLER) dispatcher.add_handler(UNBLACKLIST_STICKER_HANDLER) dispatcher.add_handler(BLACKLISTMODE_HANDLER) dispatcher.add_handler(BLACKLIST_STICKER_DEL_HANDLER)
"<b>Service uptime:</b> <code>{}</code>".format(telegram_ping, uptime), parse_mode=ParseMode.HTML, ) @run_async @sudo_plus def pingall(update: Update, context: CallbackContext): to_ping = ["Kaizoku", "Kayo", "Telegram", "Jikan"] pinged_list = ping_func(to_ping) pinged_list.insert(2, "") uptime = get_readable_time((time.time() - StartTime)) reply_msg = "⏱Ping results are 🚀:\n" reply_msg += "\n".join(pinged_list) reply_msg += "\n<b>Service uptime:</b> <code>{}</code>".format(uptime) update.effective_message.reply_text(reply_msg, parse_mode=ParseMode.HTML, disable_web_page_preview=True) PING_HANDLER = DisableAbleCommandHandler("ping", ping) PINGALL_HANDLER = DisableAbleCommandHandler("pingall", pingall) dispatcher.add_handler(PING_HANDLER) dispatcher.add_handler(PINGALL_HANDLER) __command_list__ = ["ping", "pingall"] __handlers__ = [PING_HANDLER, PINGALL_HANDLER]
def __migrate__(old_chat_id, new_chat_id): sql.migrate_chat(old_chat_id, new_chat_id) def __chat_settings__(chat_id, user_id): return f"This chat has had it's rules set: `{bool(sql.get_rules(chat_id))}`" __help__ = """ • /rules *:* get the rules for this chat. *Admins only:* • /setrules `<your rules here>`*:* set the rules for this chat. • /clearrules *:* clear the rules for this chat. """ __mod_name__ = "Rules 👣" GET_RULES_HANDLER = CommandHandler("rules", get_rules, filters=Filters.group) SET_RULES_HANDLER = CommandHandler("setrules", set_rules, filters=Filters.group) RESET_RULES_HANDLER = CommandHandler("clearrules", clear_rules, filters=Filters.group) dispatcher.add_handler(GET_RULES_HANDLER) dispatcher.add_handler(SET_RULES_HANDLER) dispatcher.add_handler(RESET_RULES_HANDLER)
from telegram.ext import run_async from Lyci import dispatcher from Lyci.modules.disable import DisableAbleCommandHandler from Lyci.modules.helper_funcs.alternate import send_message from Lyci.modules.helper_funcs.chat_status import user_admin @run_async @user_admin def send(update, context): args = update.effective_message.text.split(None, 1) creply = args[1] send_message(update.effective_message, creply) ADD_CCHAT_HANDLER = DisableAbleCommandHandler("send", send) dispatcher.add_handler(ADD_CCHAT_HANDLER) __command_list__ = ["send"] __handlers__ = [ADD_CCHAT_HANDLER]
from telegram import Update from telegram.ext import CallbackContext, run_async from Lyci import dispatcher from Lyci.modules.disable import DisableAbleCommandHandler EHI_STRINGS = "Here, new ehi files by @LyciBot 👸\n\n👉 https://www.mediafire.com/folder/eg7gpj68di622/LyciBot" @run_async def ehi(update: Update, context: CallbackContext): update.effective_message.reply_text(EHI_STRINGS) EHI_HANDLER = DisableAbleCommandHandler("ehi", ehi) dispatcher.add_handler(EHI_HANDLER)
return f"• {sql.num_disabled()} disabled items, across {sql.num_chats()} chats." def __migrate__(old_chat_id, new_chat_id): sql.migrate_chat(old_chat_id, new_chat_id) def __chat_settings__(chat_id, user_id): return build_curr_disabled(chat_id) DISABLE_HANDLER = CommandHandler("disable", disable) DISABLE_MODULE_HANDLER = CommandHandler("disablemodule", disable_module) ENABLE_HANDLER = CommandHandler("enable", enable) ENABLE_MODULE_HANDLER = CommandHandler("enablemodule", enable_module) COMMANDS_HANDLER = CommandHandler(["cmds", "disabled"], commands) TOGGLE_HANDLER = CommandHandler("listcmds", list_cmds) dispatcher.add_handler(DISABLE_HANDLER) dispatcher.add_handler(DISABLE_MODULE_HANDLER) dispatcher.add_handler(ENABLE_HANDLER) dispatcher.add_handler(ENABLE_MODULE_HANDLER) dispatcher.add_handler(COMMANDS_HANDLER) dispatcher.add_handler(TOGGLE_HANDLER) __help__ = """ • /cmds *:* check the current status of disabled commands *Admins only:* • /enable `<cmd name>`*:* enable that command • /disable `<cmd name>`*:* disable that command • /enablemodule `<module name>`*:* enable all commands in that module • /disablemodule `<module name>`*:* disable all commands in that module • /listcmds*:* list all possible toggleable commands
import requests from telegram import ParseMode, Update from telegram.ext import CallbackContext, run_async from Lyci import dispatcher from Lyci.modules.disable import DisableAbleCommandHandler @run_async def covid(update: Update, context: CallbackContext): message = update.effective_message text = message.text.split(" ", 1) if len(text) == 1: r = requests.get("https://corona.lmao.ninja/v2/all").json() reply_text = f"**Global Totals** Ъда\nCases: {r['cases']:,}\nCases Today: {r['todayCases']:,}\nDeaths: {r['deaths']:,}\nDeaths Today: {r['todayDeaths']:,}\nRecovered: {r['recovered']:,}\nActive: {r['active']:,}\nCritical: {r['critical']:,}\nCases/Mil: {r['casesPerOneMillion']}\nDeaths/Mil: {r['deathsPerOneMillion']}" else: variabla = text[1] r = requests.get(f"https://corona.lmao.ninja/v2/countries/{variabla}").json() reply_text = f"**Cases for {r['country']} Ъда**\nCases: {r['cases']:,}\nCases Today: {r['todayCases']:,}\nDeaths: {r['deaths']:,}\nDeaths Today: {r['todayDeaths']:,}\nRecovered: {r['recovered']:,}\nActive: {r['active']:,}\nCritical: {r['critical']:,}\nCases/Mil: {r['casesPerOneMillion']}\nDeaths/Mil: {r['deathsPerOneMillion']}" message.reply_text(reply_text, parse_mode=ParseMode.MARKDOWN) COVID_HANDLER = DisableAbleCommandHandler(["covid", "corona"], covid) dispatcher.add_handler(COVID_HANDLER)
f"- {event.from_id} ({event.chat_id}) : {event.text} | {datetime.datetime.now()}" ) support_chat = os.getenv("SUPPORT_CHAT") @run_async @dev_plus def logs(update: Update, context: CallbackContext): chat_username = update.effective_chat.username if not chat_username: return if chat_username != support_chat: return user = update.effective_user with open("log.txt", "rb") as f: context.bot.send_document(document=f, filename=f.name, chat_id=user.id) LOG_HANDLER = CommandHandler("logs", logs) dispatcher.add_handler(LOG_HANDLER) DEBUG_HANDLER = CommandHandler("debug", debug) dispatcher.add_handler(DEBUG_HANDLER) __mod_name__ = "Debug" __command_list__ = ["debug"] __handlers__ = [DEBUG_HANDLER]
`6h` = 6 hours `3d` = 3 days `1w` = 1 week """ __mod_name__ = "Anti-Flood 🥴" FLOOD_BAN_HANDLER = MessageHandler( Filters.all & ~Filters.status_update & Filters.group, check_flood) SET_FLOOD_HANDLER = CommandHandler("setflood", set_flood, filters=Filters.group) SET_FLOOD_MODE_HANDLER = CommandHandler( "setfloodmode", set_flood_mode, pass_args=True) # , filters=Filters.group) FLOOD_QUERY_HANDLER = CallbackQueryHandler(flood_button, pattern=r"unmute_flooder") FLOOD_HANDLER = CommandHandler("flood", flood, filters=Filters.group) dispatcher.add_handler(FLOOD_BAN_HANDLER, FLOOD_GROUP) dispatcher.add_handler(FLOOD_QUERY_HANDLER) dispatcher.add_handler(SET_FLOOD_HANDLER) dispatcher.add_handler(SET_FLOOD_MODE_HANDLER) dispatcher.add_handler(FLOOD_HANDLER) __handlers__ = [ (FLOOD_BAN_HANDLER, FLOOD_GROUP), SET_FLOOD_HANDLER, FLOOD_HANDLER, SET_FLOOD_MODE_HANDLER, ]
Anti-Spam, used by bot devs to ban spammers across all groups. This helps protect \ you and your groups by removing spam flooders as quickly as possible. *Note:* Users can appeal gbans or report spammers at @{SUPPORT_CHAT} This also integrates @Spamwatch API to remove Spammers as much as possible from your chatroom! *What is SpamWatch?* SpamWatch maintains a large constantly updated ban-list of spambots, trolls, bitcoin spammers and unsavoury characters. Constantly help banning spammers off from your group automatically So, you wont have to worry about spammers storming your group. *Note:* Users can appeal spamwatch bans at @SpamwatchSupport """ GBAN_HANDLER = CommandHandler("gban", gban) UNGBAN_HANDLER = CommandHandler("ungban", ungban) GBAN_LIST = CommandHandler("gbanlist", gbanlist) GBAN_STATUS = CommandHandler("antispam", gbanstat, filters=Filters.group) GBAN_ENFORCER = MessageHandler(Filters.all & Filters.group, enforce_gban) dispatcher.add_handler(GBAN_HANDLER) dispatcher.add_handler(UNGBAN_HANDLER) dispatcher.add_handler(GBAN_LIST) dispatcher.add_handler(GBAN_STATUS) __mod_name__ = "Anti-Spam 🛡" __handlers__ = [GBAN_HANDLER, UNGBAN_HANDLER, GBAN_LIST, GBAN_STATUS] if STRICT_GBAN: # enforce GBANS if this is set dispatcher.add_handler(GBAN_ENFORCER, GBAN_ENFORCE_GROUP) __handlers__.append((GBAN_ENFORCER, GBAN_ENFORCE_GROUP))
FACTOR_HANDLER = DisableAbleCommandHandler("factor", factor) DERIVE_HANDLER = DisableAbleCommandHandler("derive", derive) INTEGRATE_HANDLER = DisableAbleCommandHandler("integrate", integrate) ZEROES_HANDLER = DisableAbleCommandHandler("zeroes", zeroes) TANGENT_HANDLER = DisableAbleCommandHandler("tangent", tangent) AREA_HANDLER = DisableAbleCommandHandler("area", area) COS_HANDLER = DisableAbleCommandHandler("cos", cos) SIN_HANDLER = DisableAbleCommandHandler("sin", sin) TAN_HANDLER = DisableAbleCommandHandler("tan", tan) ARCCOS_HANDLER = DisableAbleCommandHandler("arccos", arccos) ARCSIN_HANDLER = DisableAbleCommandHandler("arcsin", arcsin) ARCTAN_HANDLER = DisableAbleCommandHandler("arctan", arctan) ABS_HANDLER = DisableAbleCommandHandler("abs", abs) LOG_HANDLER = DisableAbleCommandHandler("log", log) dispatcher.add_handler(SIMPLIFY_HANDLER) dispatcher.add_handler(FACTOR_HANDLER) dispatcher.add_handler(DERIVE_HANDLER) dispatcher.add_handler(INTEGRATE_HANDLER) dispatcher.add_handler(ZEROES_HANDLER) dispatcher.add_handler(TANGENT_HANDLER) dispatcher.add_handler(AREA_HANDLER) dispatcher.add_handler(COS_HANDLER) dispatcher.add_handler(SIN_HANDLER) dispatcher.add_handler(TAN_HANDLER) dispatcher.add_handler(ARCCOS_HANDLER) dispatcher.add_handler(ARCSIN_HANDLER) dispatcher.add_handler(ARCTAN_HANDLER) dispatcher.add_handler(ABS_HANDLER) dispatcher.add_handler(LOG_HANDLER)
try: result = f"{repr(eval(body, env))}" except: pass else: result = f"{value}{func_return}" if result: return result @dev_plus @run_async def clear(update: Update, context: CallbackContext): bot = context.bot log_input(update) global namespaces if update.message.chat_id in namespaces: del namespaces[update.message.chat_id] send("Cleared locals.", bot, update) EVAL_HANDLER = CommandHandler(("e", "ev", "eva", "eval"), evaluate) EXEC_HANDLER = CommandHandler(("x", "ex", "exe", "exec", "py"), execute) CLEAR_HANDLER = CommandHandler("clearlocals", clear) dispatcher.add_handler(EVAL_HANDLER) dispatcher.add_handler(EXEC_HANDLER) dispatcher.add_handler(CLEAR_HANDLER) __mod_name__ = "Eval Module"
LOGGER.warning(update) LOGGER.exception( "ERROR unmnuting user %s in chat %s (%s) due to %s", user_id, chat.title, chat.id, excp.message, ) message.reply_text("Well damn, I can't unmute that user.") RBAN_HANDLER = CommandHandler("rban", rban, filters=CustomFilters.sudo_filter) RUNBAN_HANDLER = CommandHandler("runban", runban, filters=CustomFilters.sudo_filter) RKICK_HANDLER = CommandHandler("rpunch", rkick, filters=CustomFilters.sudo_filter) RMUTE_HANDLER = CommandHandler("rmute", rmute, filters=CustomFilters.sudo_filter) RUNMUTE_HANDLER = CommandHandler("runmute", runmute, filters=CustomFilters.sudo_filter) dispatcher.add_handler(RBAN_HANDLER) dispatcher.add_handler(RUNBAN_HANDLER) dispatcher.add_handler(RKICK_HANDLER) dispatcher.add_handler(RMUTE_HANDLER) dispatcher.add_handler(RUNMUTE_HANDLER)
is_blacklisted = sql.is_user_blacklisted(user_id) text = "Blacklisted: <b>{}</b>" if user_id in [777000, 1087968824]: return "" if user_id == dispatcher.bot.id: return "" if int(user_id) in DRAGONS + TIGERS + WOLVES: return "" if is_blacklisted: text = text.format("Yes") reason = sql.get_reason(user_id) if reason: text += f"\nReason: <code>{reason}</code>" else: text = text.format("No") return text BL_HANDLER = CommandHandler("ignore", bl_user) UNBL_HANDLER = CommandHandler("notice", unbl_user) BLUSERS_HANDLER = CommandHandler("ignoredlist", bl_users) dispatcher.add_handler(BL_HANDLER) dispatcher.add_handler(UNBL_HANDLER) dispatcher.add_handler(BLUSERS_HANDLER) __mod_name__ = "Blacklisting Users" __handlers__ = [BL_HANDLER, UNBL_HANDLER, BLUSERS_HANDLER]
*What is that health thingy?* Come and see [HP System explained](https://t.me/HiTechRockets) """ SET_BIO_HANDLER = DisableAbleCommandHandler("setbio", set_about_bio) GET_BIO_HANDLER = DisableAbleCommandHandler("bio", about_bio) STATS_HANDLER = CommandHandler("stats", stats) ID_HANDLER = DisableAbleCommandHandler("id", get_id) GIFID_HANDLER = DisableAbleCommandHandler("gifid", gifid) INFO_HANDLER = DisableAbleCommandHandler(("info", "book"), info) SET_ABOUT_HANDLER = DisableAbleCommandHandler("setme", set_about_me) GET_ABOUT_HANDLER = DisableAbleCommandHandler("me", about_me) dispatcher.add_handler(STATS_HANDLER) dispatcher.add_handler(ID_HANDLER) dispatcher.add_handler(GIFID_HANDLER) dispatcher.add_handler(INFO_HANDLER) dispatcher.add_handler(SET_BIO_HANDLER) dispatcher.add_handler(GET_BIO_HANDLER) dispatcher.add_handler(SET_ABOUT_HANDLER) dispatcher.add_handler(GET_ABOUT_HANDLER) __mod_name__ = "Info❓" __command_list__ = ["setbio", "bio", "setme", "me", "info"] __handlers__ = [ ID_HANDLER, GIFID_HANDLER, INFO_HANDLER, SET_BIO_HANDLER,