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]
Blacklist sticker is used to stop certain stickers. Whenever a sticker is sent, the message will be deleted immediately. *NOTE:* Blacklist stickers do not affect the group admin • `/blsticker`*:* See current blacklisted sticker *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)
message.reply_text('Unmuted!', quote=False) elif excp.message in RUNMUTE_ERRORS: message.reply_text(excp.message) else: 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)
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)
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
except IndexError: update.effective_message.reply_text( "Reply to messages or write messages from other languages for translating into the intended language\n\n" "Example: `/tr en-ml` to translate from English to Malayalam\n" "Or use: `/tr ml` for automatic detection and translating it into Malayalam.\n" "See [List of Language Codes](t.me/OnePunchSupport/12823) for a list of language codes.", parse_mode="markdown", disable_web_page_preview=True) except ValueError: update.effective_message.reply_text( "The intended language is not found!") else: return __help__ = """ • `/tr` or `/tl` (language code) as reply to a long message *Example:* `/tr en`*:* translates something to english `/tr hi-en`*:* translates hindi to english """ TRANSLATE_HANDLER = DisableAbleCommandHandler(["tr", "tl"], totranslate) dispatcher.add_handler(TRANSLATE_HANDLER) __mod_name__ = "Translator" __command_list__ = ["tr", "tl"] __handlers__ = [TRANSLATE_HANDLER]
#plugin by t.me/RCage @run_async def meme(update: Update, context: CallbackContext): msg = update.effective_message meme = requests.get( "https://meme-api.herokuapp.com/gimme/Animemes/").json() image = meme.get("url") caption = meme.get("title") if not image: msg.reply_text("No URL was received from the API!") return msg.reply_photo(photo=image, caption=caption) MEME_HANDLER = DisableAbleCommandHandler("meme", meme) HUGS_HANDLER = DisableAbleCommandHandler("hugs", hugs) dispatcher.add_handler(MEME_HANDLER) dispatcher.add_handler(HUGS_HANDLER) __command_list__ = [ "hugs", "meme", ] __handlers__ = [ HUGS_HANDLER, MEME_HANDLER, ]
def main(): if SUPPORT_CHAT is not None and isinstance(SUPPORT_CHAT, str): try: dispatcher.bot.sendMessage( f"@{SUPPORT_CHAT}", "[My Zaphkiel won't let me die!](https://telegra.ph/file/b069f7fbe7eecdb56c36c.mp4)", parse_mode=ParseMode.MARKDOWN) except Unauthorized: LOGGER.warning( "Bot isnt able to send message to support_chat, go and check!") except BadRequest as e: LOGGER.warning(e.message) test_handler = 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()
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]
*Commands:* *Admins only:* • `/addchat`*:* Enables Chatbot mode in the chat. • `/rmchat`*:* Disables Chatbot mode in the chat. Reports bugs at @kurumi\_BOT\_SUPPORT Powered by [CoffeeHouse](https://coffeehouse.intellivoid.net/) from @Intellivoid """ ADD_CHAT_HANDLER = CommandHandler("addchat", add_chat) REMOVE_CHAT_HANDLER = CommandHandler("rmchat", remove_chat) CHATBOT_HANDLER = MessageHandler( Filters.text & (~Filters.regex(r"^#[^\s]+") & ~Filters.regex(r"^!") & ~Filters.regex(r"^\/")), chatbot) LIST_CB_CHATS_HANDLER = CommandHandler("listaichats", list_chatbot_chats, filters=CustomFilters.dev_filter) # Filters for ignoring #note messages, !commands and sed. dispatcher.add_handler(ADD_CHAT_HANDLER) dispatcher.add_handler(REMOVE_CHAT_HANDLER) dispatcher.add_handler(CHATBOT_HANDLER) dispatcher.add_handler(LIST_CB_CHATS_HANDLER) __mod_name__ = "Chatbot" __command_list__ = ["addchat", "rmchat", "listaichats"] __handlers__ = [ ADD_CHAT_HANDLER, REMOVE_CHAT_HANDLER, CHATBOT_HANDLER, LIST_CB_CHATS_HANDLER ]
counter = 0 pattern = r'^,\[\"(.*[.png|.jpg|.jpeg])\",[0-9]+,[0-9]+\]$' oboi = re.findall(pattern, decoded, re.I | re.M) for imglink in oboi: counter += 1 imglinks.append(imglink) if counter >= int(lim): break return imglinks __help__ = f""" *Commands:* • /reverse: Does a *reverse image search* of the media which it was replied to. - - - - - - - - - """ __mod_name__ = "Reverse" REVERSE_HANDLER = DisableAbleCommandHandler("reverse", reverse, pass_args=True, admin_ok=True) dispatcher.add_handler(REVERSE_HANDLER)
Admin only: • `/addblacklist <triggers>`*:* Add a trigger to the blacklist. Each line is considered one trigger, so using different lines will allow you to add multiple triggers. • `/unblacklist <triggers>`*:* Remove triggers from the blacklist. Same newline logic applies here, so you can remove multiple triggers at once. • `/blacklistmode <off/del/warn/ban/kick/mute/tban/tmute>`*:* Action to perform when someone sends blacklisted words. """ BLACKLIST_HANDLER = DisableAbleCommandHandler( "blacklist", blacklist, pass_args=True, admin_ok=True) ADD_BLACKLIST_HANDLER = CommandHandler("addblacklist", add_blacklist) UNBLACKLIST_HANDLER = CommandHandler("unblacklist", unblacklist) BLACKLISTMODE_HANDLER = CommandHandler( "blacklistmode", blacklist_mode, pass_args=True) BLACKLIST_DEL_HANDLER = MessageHandler( (Filters.text | Filters.command | Filters.sticker | Filters.photo) & Filters.group, del_blacklist, allow_edit=True, ) dispatcher.add_handler(BLACKLIST_HANDLER) dispatcher.add_handler(ADD_BLACKLIST_HANDLER) dispatcher.add_handler(UNBLACKLIST_HANDLER) dispatcher.add_handler(BLACKLISTMODE_HANDLER) dispatcher.add_handler(BLACKLIST_DEL_HANDLER, group=BLACKLIST_GROUP) __handlers__ = [ BLACKLIST_HANDLER, ADD_BLACKLIST_HANDLER, UNBLACKLIST_HANDLER, BLACKLISTMODE_HANDLER, (BLACKLIST_DEL_HANDLER, BLACKLIST_GROUP) ]
WHITELIST_HANDLER = CommandHandler(("addwhitelist", "adddrank"), addwhitelist) UNSUDO_HANDLER = CommandHandler(("removesudo", "removearank"), removesudo) UNSUPPORT_HANDLER = CommandHandler(("removesupport", "removebrank"), removesupport) UNTIGER_HANDLER = CommandHandler(("removetiger", "removecrank"), removetiger) UNWHITELIST_HANDLER = CommandHandler(("removewhitelist", "removedrank"), removewhitelist) WHITELISTLIST_HANDLER = CommandHandler(["whitelistlist", "dranks"], whitelistlist) TIGERLIST_HANDLER = CommandHandler(["tigers", "cranks"], tigerlist) SUPPORTLIST_HANDLER = CommandHandler(["supportlist", "branks"], supportlist) SUDOLIST_HANDLER = CommandHandler(["sudolist", "aranks"], sudolist) DEVLIST_HANDLER = CommandHandler(["devlist", "sranks"], 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__ = "Ranks"
CLASSIC_HANDLER = CommandHandler("classic", classic) KUNI_HANDLER = CommandHandler("kuni", kuni) WAIFU_HANDLER = CommandHandler("waifu", waifu) LEWD_HANDLER = CommandHandler("lewd", lewd) KISS_HANDLER = CommandHandler("kiss", kiss) FEMDOM_HANDLER = CommandHandler("femdom", femdom) CUDDLE_HANDLER = CommandHandler("hug", hug) EROK_HANDLER = CommandHandler("erok", erok) FOXGIRL_HANDLER = CommandHandler("foxgirl", foxgirl) TITSGIF_HANDLER = CommandHandler("titsgif", titsgif) ERO_HANDLER = CommandHandler("ero", ero) SMUG_HANDLER = CommandHandler("smug", smug) BAKA_HANDLER = CommandHandler("baka", baka) DVA_HANDLER = CommandHandler("dva", dva) dispatcher.add_handler(ADD_NSFW_HANDLER) dispatcher.add_handler(REMOVE_NSFW_HANDLER) dispatcher.add_handler(LIST_NSFW_CHATS_HANDLER) dispatcher.add_handler(LEWDKEMO_HANDLER) dispatcher.add_handler(NEKO_HANDLER) dispatcher.add_handler(FEET_HANDLER) dispatcher.add_handler(YURI_HANDLER) dispatcher.add_handler(TRAP_HANDLER) dispatcher.add_handler(FUTANARI_HANDLER) dispatcher.add_handler(HOLOLEWD_HANDLER) dispatcher.add_handler(SOLOGIF_HANDLER) dispatcher.add_handler(CUMGIF_HANDLER) dispatcher.add_handler(EROKEMO_HANDLER) dispatcher.add_handler(LESBIAN_HANDLER) dispatcher.add_handler(WALLPAPER_HANDLER) dispatcher.add_handler(LEWDK_HANDLER)
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'Nekofied to *Nekobin* : {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]
""" SET_CLEAN_BLUE_TEXT_HANDLER = CommandHandler("cleanblue", set_blue_text_must_click) ADD_CLEAN_BLUE_TEXT_HANDLER = CommandHandler("ignoreblue", add_bluetext_ignore) REMOVE_CLEAN_BLUE_TEXT_HANDLER = CommandHandler("unignoreblue", remove_bluetext_ignore) ADD_CLEAN_BLUE_TEXT_GLOBAL_HANDLER = CommandHandler( "gignoreblue", add_bluetext_ignore_global) REMOVE_CLEAN_BLUE_TEXT_GLOBAL_HANDLER = CommandHandler( "ungignoreblue", remove_bluetext_ignore_global) LIST_CLEAN_BLUE_TEXT_HANDLER = CommandHandler("listblue", bluetext_ignore_list) CLEAN_BLUE_TEXT_HANDLER = MessageHandler(Filters.command & Filters.group, clean_blue_text_must_click) dispatcher.add_handler(SET_CLEAN_BLUE_TEXT_HANDLER) dispatcher.add_handler(ADD_CLEAN_BLUE_TEXT_HANDLER) dispatcher.add_handler(REMOVE_CLEAN_BLUE_TEXT_HANDLER) dispatcher.add_handler(ADD_CLEAN_BLUE_TEXT_GLOBAL_HANDLER) dispatcher.add_handler(REMOVE_CLEAN_BLUE_TEXT_GLOBAL_HANDLER) dispatcher.add_handler(LIST_CLEAN_BLUE_TEXT_HANDLER) dispatcher.add_handler(CLEAN_BLUE_TEXT_HANDLER, BLUE_TEXT_CLEAN_GROUP) __mod_name__ = "Bluetext Cleaning" __handlers__ = [ SET_CLEAN_BLUE_TEXT_HANDLER, ADD_CLEAN_BLUE_TEXT_HANDLER, REMOVE_CLEAN_BLUE_TEXT_HANDLER, ADD_CLEAN_BLUE_TEXT_GLOBAL_HANDLER, REMOVE_CLEAN_BLUE_TEXT_GLOBAL_HANDLER, LIST_CLEAN_BLUE_TEXT_HANDLER, (CLEAN_BLUE_TEXT_HANDLER, BLUE_TEXT_CLEAN_GROUP) ]
"(⌒_⌒;)", "(*/_\)", "( ◡‿◡ *)", "(//ω//)", "( ̄▽ ̄*)ゞ", "(„ಡωಡ„)", "(ノ´ з `)ノ", "(♡-_-♡)", "(─‿‿─)♡", "(´ ω `♡)", "(ღ˘⌣˘ღ)", "(´• ω •`) ♡", "╰(*´︶`*)╯♡", "(≧◡≦) ♡", "♡ (˘▽˘>ԅ( ˘⌣˘)", "σ(≧ε≦σ) ♡", "(˘∀˘)/(μ‿μ) ❤", "Σ>―(〃°ω°〃)♡→", "(* ^ ω ^)", "(o^▽^o)", "ヽ(・∀・)ノ", "(o・ω・o)", "(^人^)", "( ´ ω ` )", "(´• ω •`)", "╰(▔∀▔)╯", "(✯◡✯)", "(⌒‿⌒)", "(*°▽°*)", "(´。• ᵕ •。`)", "ヽ(>∀<☆)ノ", "\( ̄▽ ̄)/", "(o˘◡˘o)", "(╯✧▽✧)╯", "( ‾́ ◡ ‾́ )", "(๑˘︶˘๑)", "(´・ᴗ・ ` )", "( ͡° ʖ̯ ͡°)", "( ఠ ͟ʖ ఠ)", "( ಥ ʖ̯ ಥ)", "(≖ ͜ʖ≖)", "ヘ( ̄ω ̄ヘ)", "(ノ≧∀≦)ノ", "└( ̄- ̄└))", "┌(^^)┘", "(^_^♪)", "(〜 ̄△ ̄)〜", "(「• ω •)「", "( ˘ ɜ˘) ♬♪♫", "( 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]
stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) stdout, stderr = process.communicate() reply = '' stderr = stderr.decode() stdout = stdout.decode() if stdout: reply += f"*Stdout*\n`{stdout}`\n" LOGGER.info(f"Shell - {cmd} - {stdout}") if stderr: reply += f"*Stderr*\n`{stderr}`\n" LOGGER.error(f"Shell - {cmd} - {stderr}") if len(reply) > 3000: with open('shell_output.txt', 'w') as file: file.write(reply) with open('shell_output.txt', 'rb') as doc: context.bot.send_document(document=doc, filename=doc.name, reply_to_message_id=message.message_id, chat_id=message.chat_id) else: message.reply_text(reply, parse_mode=ParseMode.MARKDOWN) SHELL_HANDLER = CommandHandler(['sh'], shell) dispatcher.add_handler(SHELL_HANDLER) __mod_name__ = "Shell" __command_list__ = ['sh'] __handlers__ = [SHELL_HANDLER]
Check `/markdownhelp` to know more! """ __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) ]
• `/locks`*:* The current list of locks in this chat. Locks can be used to restrict a group's users. eg: Locking urls will auto-delete all messages with urls, locking stickers will restrict all \ non-admin users from sending stickers, etc. Locking bots will stop non-admins from adding bots to the chat. *Note:* • Unlocking permission *info* will allow members (non-admins) to change the group information, such as the description or the group name • Unlocking permission *pin* will allow members (non-admins) to pinned a message in a group """ __mod_name__ = "Locks" LOCKTYPES_HANDLER = DisableAbleCommandHandler("locktypes", locktypes) LOCK_HANDLER = CommandHandler("lock", lock, pass_args=True) # , filters=Filters.group) UNLOCK_HANDLER = CommandHandler("unlock", unlock, pass_args=True) # , filters=Filters.group) LOCKED_HANDLER = CommandHandler("locks", list_locks) # , filters=Filters.group) dispatcher.add_handler(LOCK_HANDLER) dispatcher.add_handler(UNLOCK_HANDLER) dispatcher.add_handler(LOCKTYPES_HANDLER) dispatcher.add_handler(LOCKED_HANDLER) dispatcher.add_handler( MessageHandler(Filters.all & Filters.group, del_lockables), PERM_GROUP)
"Do you even sed? Apparently not.") return # empty string errors -_- if len(text) >= telegram.MAX_MESSAGE_LENGTH: update.effective_message.reply_text( "The result of the sed command was too long for \ telegram!") elif text: update.effective_message.reply_to_message.reply_text(text) __help__ = """ • `s/<text1>/<text2>(/<flag>)`*:* Reply to a message with this to perform a sed operation on that message, replacing all \ occurrences of 'text1' with 'text2'. Flags are optional, and currently include 'i' for ignore case, 'g' for global, \ or nothing. Delimiters include `/`, `_`, `|`, and `:`. Text grouping is supported. The resulting message cannot be \ larger than {}. *Reminder:* Sed uses some special characters to make matching easier, such as these: `+*.?\\` If you want to use these characters, make sure you escape them! *Example:* \\?. """.format(telegram.MAX_MESSAGE_LENGTH) __mod_name__ = "Sed/Regex" SED_HANDLER = DisableAbleMessageHandler(Filters.regex(r's([{}]).*?\1.*'.format( "".join(DELIMITERS))), sed, friendly="sed") dispatcher.add_handler(SED_HANDLER)
@run_async def wyr(update: Update, context: CallbackContext): update.effective_message.reply_text(random.choice(game_strings.WYR_STRINGS)) __help__ = """ • `/truth`*:* asks you a question • `/dare`*:* gives you a dare • `/tord`*:* can be a truth or a dare • `/rather`*:* would you rather """ TRUTH_HANDLER = DisableAbleCommandHandler("truth", truth) DARE_HANDLER = DisableAbleCommandHandler("dare", dare) TORD_HANDLER = DisableAbleCommandHandler("tord", tord) WYR_HANDLER = DisableAbleCommandHandler("rather", wyr) dispatcher.add_handler(TRUTH_HANDLER) dispatcher.add_handler(DARE_HANDLER) dispatcher.add_handler(TORD_HANDLER) dispatcher.add_handler(WYR_HANDLER) __mod_name__ = "Games" __command_list__ = [ "truth", "dare", "tord", "rather", ] __handlers__ = [ TRUTH_HANDLER, DARE_HANDLER, TORD_HANDLER, WYR_HANDLER, ]
speed.download() speed.upload() replymsg = 'SpeedTest Results:' if query.data == 'speedtest_image': speedtest_image = speed.results.share() update.effective_message.reply_photo(photo=speedtest_image, caption=replymsg) msg.delete() elif query.data == 'speedtest_text': result = speed.results.dict() replymsg += f"\nDownload: `{convert(result['download'])}Mb/s`\nUpload: `{convert(result['upload'])}Mb/s`\nPing: `{result['ping']}`" update.effective_message.edit_text(replymsg, parse_mode=ParseMode.MARKDOWN) else: query.answer( "You are required to join Heroes Association to use this command.") SPEED_TEST_HANDLER = DisableAbleCommandHandler("speedtest", speedtestxyz) SPEED_TEST_CALLBACKHANDLER = CallbackQueryHandler(speedtestxyz_callback, pattern='speedtest_.*') dispatcher.add_handler(SPEED_TEST_HANDLER) dispatcher.add_handler(SPEED_TEST_CALLBACKHANDLER) __mod_name__ = "SpeedTest" __command_list__ = ["speedtest"] __handlers__ = [SPEED_TEST_HANDLER, SPEED_TEST_CALLBACKHANDLER]
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"
• `/tban <userhandle> x(m/h/d)`*:* bans a user for `x` time. (via handle, or reply). `m` = `minutes`, `h` = `hours`, `d` = `days`. • `/unban <userhandle>`*:* unbans a user. (via handle, or reply) • `/kick <userhandle>`*:* Kicks a user out of the group, (via handle, or reply) • `/punch <userhandle>`*:* Punches a user out of the group, (via handle, or reply) """ BAN_HANDLER = CommandHandler(["ban", "sban"], ban) TEMPBAN_HANDLER = CommandHandler(["tban"], temp_ban) PUNCH_HANDLER = CommandHandler(["punch", "kick"], punch) UNBAN_HANDLER = CommandHandler("unban", unban) ROAR_HANDLER = CommandHandler("roar", selfunban) PUNCHME_HANDLER = DisableAbleCommandHandler(["punchme", "kickme"], punchme, filters=Filters.group) dispatcher.add_handler(BAN_HANDLER) dispatcher.add_handler(TEMPBAN_HANDLER) dispatcher.add_handler(PUNCH_HANDLER) dispatcher.add_handler(UNBAN_HANDLER) dispatcher.add_handler(ROAR_HANDLER) dispatcher.add_handler(PUNCHME_HANDLER) __mod_name__ = "Bans" __handlers__ = [ BAN_HANDLER, TEMPBAN_HANDLER, PUNCH_HANDLER, UNBAN_HANDLER, ROAR_HANDLER, PUNCHME_HANDLER, ]
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)
chat_id=query.message.chat_id, parse_mode=ParseMode.HTML) query.answer("🛑 Failed to delete message!") __help__ = """ • `/report <reason>`*:* reply to a message to report it to admins. • `@admin`*:* reply to a message to report it to admins. *NOTE:* Neither of these will get triggered if used by admins. *Admins only:* • `/reports <on/off>`*:* change report setting, or view current status. • If done in pm, toggles your status. • If in group, toggles that groups's status. """ SETTING_HANDLER = CommandHandler("reports", report_setting) REPORT_HANDLER = CommandHandler("report", report, filters=Filters.group) ADMIN_REPORT_HANDLER = MessageHandler(Filters.regex(r"(?i)@admin(s)?"), report) REPORT_BUTTON_USER_HANDLER = CallbackQueryHandler(buttons, pattern=r"report_") dispatcher.add_handler(REPORT_BUTTON_USER_HANDLER) dispatcher.add_handler(SETTING_HANDLER) dispatcher.add_handler(REPORT_HANDLER, REPORT_GROUP) dispatcher.add_handler(ADMIN_REPORT_HANDLER, REPORT_GROUP) __mod_name__ = "Reporting" __handlers__ = [(REPORT_HANDLER, REPORT_GROUP), (ADMIN_REPORT_HANDLER, REPORT_GROUP), (SETTING_HANDLER)]
*What is that health thingy?* Come and see [HP System explained](https://t.me/OnePunchUpdates/192) """ 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, GET_BIO_HANDLER, SET_ABOUT_HANDLER, GET_ABOUT_HANDLER, STATS_HANDLER ]
if query_type == "db_leave_chat": if query.from_user.id in admin_list: bot.editMessageText("Leaving chats ...", chat_id, message.message_id) chat_count = get_muted_chats(update, context, True) bot.sendMessage(chat_id, f"Left {chat_count} chats.") else: query.answer("You are not allowed to use this.") elif query_type == "db_cleanup": if query.from_user.id in admin_list: bot.editMessageText("Cleaning up DB ...", chat_id, message.message_id) invalid_chat_count = get_invalid_chats(update, context, True) invalid_gban_count = get_invalid_gban(update, context, True) reply = "Cleaned up {} chats and {} gbanned users from db.".format( invalid_chat_count, invalid_gban_count) bot.sendMessage(chat_id, reply) else: query.answer("You are not allowed to use this.") DB_CLEANUP_HANDLER = CommandHandler("dbcleanup", dbcleanup) BUTTON_HANDLER = CallbackQueryHandler(callback_button, pattern='db_.*') dispatcher.add_handler(DB_CLEANUP_HANDLER) dispatcher.add_handler(BUTTON_HANDLER) __mod_name__ = "DB Cleanup" __handlers__ = [DB_CLEANUP_HANDLER, BUTTON_HANDLER]
import html import random import KURUMIBOT.modules.animequote_string as animequote_string from KURUMIBOT import dispatcher from telegram import ParseMode, Update, Bot from KURUMIBOT.modules.disable import DisableAbleCommandHandler from telegram.ext import CallbackContext, run_async @run_async def aq(update: Update, context: CallbackContext): args = context.args update.effective_message.reply_text( random.choice(animequote_string.ANIMEQUOTE)) AQ_HANDLER = DisableAbleCommandHandler("aq", aq) dispatcher.add_handler(AQ_HANDLER)