Reports bugs at @{SUPPORT_CHAT} *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__ = "Lʏᴅɪᴀ" __command_list__ = ["addchat", "rmchat", "listaichats"] __handlers__ = [ ADD_CHAT_HANDLER, REMOVE_CHAT_HANDLER, CHATBOT_HANDLER, LIST_CB_CHATS_HANDLER, ]
>> /kick <userhandle>: kicks a user out of the group, (via handle, or reply) *An example of temporarily banning someone:* `/tban @username 2h`; this bans a user for 2 hours. """ BAN_HANDLER = DisableAbleCommandHandler(["ban", "sban"], ban, run_async=True) TEMPBAN_HANDLER = DisableAbleCommandHandler(["tban"], temp_ban, run_async=True) PUNCH_HANDLER = DisableAbleCommandHandler("kick", kick, run_async=True) UNBAN_HANDLER = DisableAbleCommandHandler("unban", unban, run_async=True) ROAR_HANDLER = DisableAbleCommandHandler("roar", selfunban, run_async=True) PUNCHME_HANDLER = DisableAbleCommandHandler( "kickme", kickme, filters=Filters.chat_type.groups, run_async=True ) 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, ]
""" 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), ]
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) 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()
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[.](https://telegra.ph/file/f584b643c6f4be0b1de53.jpg) 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))
*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 ]
update.effective_message.reply_text(res, parse_mode="html") def __gdpr__(user_id): end_afk(user_id) __mod_name__ = "AFK" __help__ = """ ✪ /afk <reason>*:* Mark yourself as AFK. ✪ `brb <reason>`*:* Same as the afk command, but not a command.\n When marked as AFK, any mentions will be replied to with a message stating that you're not available! """ AFK_HANDLER = DisableAbleCommandHandler("afk", afk) AFK_REGEX_HANDLER = MessageHandler(Filters.regex("(?i)brb"), afk) NO_AFK_HANDLER = MessageHandler(Filters.all & Filters.group, no_longer_afk) AFK_REPLY_HANDLER = MessageHandler(Filters.all & Filters.group, reply_afk) dispatcher.add_handler(AFK_HANDLER, AFK_GROUP) dispatcher.add_handler(AFK_REGEX_HANDLER, AFK_GROUP) dispatcher.add_handler(NO_AFK_HANDLER, AFK_GROUP) dispatcher.add_handler(AFK_REPLY_HANDLER, AFK_REPLY_GROUP)
__mod_name__ = "Connection" __help__ = """ Sometimes, you just want to add some notes and filters to a group chat, but you don't want everyone to see; This is where connections come in... This allows you to connect to a chat's database, and add things to it without the commands appearing in chat! For obvious reasons, you need to be an admin to add things; but any member in the group can view your data. • /connect: Connects to chat (Can be done in a group by /connect or /connect <chat id> in PM) • /connection: List connected chats • /disconnect: Disconnect from a chat • /helpconnect: List available commands that can be used remotely *Admin only:* • /allowconnect <yes/no>: allow a user to connect to a chat """ CONNECT_CHAT_HANDLER = CommandHandler("connect", connect_chat, pass_args=True) CONNECTION_CHAT_HANDLER = CommandHandler("connection", connection_chat) DISCONNECT_CHAT_HANDLER = CommandHandler("disconnect", disconnect_chat) ALLOW_CONNECTIONS_HANDLER = CommandHandler("allowconnect", allow_connections, pass_args=True) HELP_CONNECT_CHAT_HANDLER = CommandHandler("helpconnect", help_connect_chat) CONNECT_BTN_HANDLER = CallbackQueryHandler(connect_button, pattern=r"connect") dispatcher.add_handler(CONNECT_CHAT_HANDLER) dispatcher.add_handler(CONNECTION_CHAT_HANDLER) dispatcher.add_handler(DISCONNECT_CHAT_HANDLER) dispatcher.add_handler(ALLOW_CONNECTIONS_HANDLER) dispatcher.add_handler(HELP_CONNECT_CHAT_HANDLER) dispatcher.add_handler(CONNECT_BTN_HANDLER)
• /kayo `<anime>`*:* search an anime on animekayo.com • /airing `<anime>`*:* returns anime airing info. """ ANIME_HANDLER = DisableAbleCommandHandler("anime", anime) AIRING_HANDLER = DisableAbleCommandHandler("airing", airing) CHARACTER_HANDLER = DisableAbleCommandHandler("character", character) MANGA_HANDLER = DisableAbleCommandHandler("manga", manga) USER_HANDLER = DisableAbleCommandHandler("user", user) UPCOMING_HANDLER = DisableAbleCommandHandler("upcoming", upcoming) KAIZOKU_SEARCH_HANDLER = DisableAbleCommandHandler("kaizoku", kaizoku) KAYO_SEARCH_HANDLER = DisableAbleCommandHandler("kayo", kayo) BUTTON_HANDLER = CallbackQueryHandler(button, pattern='anime_.*') dispatcher.add_handler(BUTTON_HANDLER) dispatcher.add_handler(ANIME_HANDLER) dispatcher.add_handler(CHARACTER_HANDLER) dispatcher.add_handler(MANGA_HANDLER) dispatcher.add_handler(AIRING_HANDLER) dispatcher.add_handler(USER_HANDLER) dispatcher.add_handler(KAIZOKU_SEARCH_HANDLER) dispatcher.add_handler(KAYO_SEARCH_HANDLER) dispatcher.add_handler(UPCOMING_HANDLER) __mod_name__ = "Anime" __command_list__ = [ "anime", "manga", "character", "user", "upcoming", "kaizoku", "airing", "kayo" ] __handlers__ = [
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__ = "Tʀᴀɴsʟᴀᴛᴏʀ" __command_list__ = ["tr", "tl"] __handlers__ = [TRANSLATE_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]
def main(): 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="127.0.0.1", 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()