def __chat_settings__(chat_id, user_id): blacklisted = sql.num_blacklist_chat_filters(chat_id) return tl(user_id, "There are `{}` blacklisted words.").format(blacklisted) def __stats__(): return tl(OWNER_ID, "`{}` blacklist triggers, across `{}` chats.").format( sql.num_blacklist_filters(), sql.num_blacklist_filter_chats()) __mod_name__ = "Word Blacklists" __help__ = "blacklist_help" BLACKLIST_HANDLER = DisableAbleCommandHandler("blacklist", blacklist, pass_args=True, admin_ok=True) ADD_BLACKLIST_HANDLER = CommandHandler("addblacklist", add_blacklist) UNBLACKLIST_HANDLER = CommandHandler(["unblacklist", "rmblacklist"], 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) dispatcher.add_handler(BLACKLIST_HANDLER) dispatcher.add_handler(ADD_BLACKLIST_HANDLER) dispatcher.add_handler(UNBLACKLIST_HANDLER) dispatcher.add_handler(BLACKLISTMODE_HANDLER)
for trigger in filters: sql.add_to_blacklist(chat_id, trigger) def __migrate__(old_chat_id, new_chat_id): sql.migrate_chat(old_chat_id, new_chat_id) def __chat_settings__(chat_id, user_id): cust_filters = sql.get_chat_triggers(chat_id) return tl(user_id, "There are `{}` custom filters here.").format(len(cust_filters)) __help__ = "filters_help" __mod_name__ = "Filters" FILTER_HANDLER = CommandHandler("filter", filters) STOP_HANDLER = CommandHandler("stop", stop_filter) 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)
sql.add_to_blacklist(chat_id, trigger) def __migrate__(old_chat_id, new_chat_id): sql.migrate_chat(old_chat_id, new_chat_id) def __chat_settings__(chat_id, user_id): blacklisted = sql.num_stickers_chat_filters(chat_id) return tl(user_id, "Ada `{}` daftar hitam stiker.").format(blacklisted) def __stats__(): return tl(OWNER_ID, "{} pemicu daftar hitam stiker, di seluruh {} obrolan.").format(sql.num_stickers_filters(), sql.num_stickers_filter_chats()) __help__ = "blstickers_help" __mod_name__ = "Sticker Blacklist" BLACKLIST_STICKER_HANDLER = DisableAbleCommandHandler("blsticker", blackliststicker, pass_args=True, admin_ok=True) ADDBLACKLIST_STICKER_HANDLER = DisableAbleCommandHandler("addblsticker", add_blackliststicker) UNBLACKLIST_STICKER_HANDLER = CommandHandler(["unblsticker", "rmblsticker"], unblackliststicker) BLACKLISTMODE_HANDLER = CommandHandler("blstickermode", blacklist_mode, pass_args=True) 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)
text = tl(update.effective_message, "Penghapus pesan biru telah di *aktifkan*.") send_message(update.effective_message, text, parse_mode="markdown") else: send_message( update.effective_message, tl(update.effective_message, "Argumen tidak dikenal - harap gunakan 'yes', atau 'no'.")) else: send_message( update.effective_message, tl(update.effective_message, "Pengaturan untuk penghapus pesan biru saat ini di {}: *{}*"). format(chat_name, "Enabled" if sql.is_enable(chat_id) else "Disabled"), parse_mode="markdown") __help__ = "cleaner_help" __mod_name__ = "Cleaner" SET_CLEAN_BLUE_TEXT_HANDLER = DisableAbleCommandHandler( "cleanbluetext", set_blue_text_must_click, pass_args=True) 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(CLEAN_BLUE_TEXT_HANDLER, 15)
user.id, user.first_name + " " + (user.last_name or ""))) #if user.username: # name = escape_markdown("@" + user.username) if status == "administrator": text += "\n` • `{}".format(name) text += tl(user_id, "\n\nYou are *{}*").format( dispatcher.bot.get_chat_member(chat_id, user_id).status) return text __help__ = "admin_help" __mod_name__ = "Admin" PIN_HANDLER = DisableAbleCommandHandler("pin", pin, pass_args=True, filters=Filters.group) UNPIN_HANDLER = DisableAbleCommandHandler("unpin", unpin, filters=Filters.group) PERMAPIN_HANDLER = DisableAbleCommandHandler("permapin", permapin, filters=Filters.group) INVITE_HANDLER = CommandHandler("invitelink", invite, filters=Filters.group) PROMOTE_HANDLER = DisableAbleCommandHandler("promote", promote, pass_args=True, filters=Filters.group) DEMOTE_HANDLER = DisableAbleCommandHandler("demote",
send_message(update.effective_message, tl(update.effective_message, "Dibisukan untuk *{}*!").format(time_val), quote=False) return log else: LOGGER.warning(update) LOGGER.exception("ERROR muting user %s in chat %s (%s) due to %s", user_id, chat.title, chat.id, excp.message) send_message( update.effective_message, tl(update.effective_message, "Yah sial, aku tidak bisa membisukan pengguna itu.")) return "" __help__ = "mute_help" __mod_name__ = "Muting" MUTE_HANDLER = DisableAbleCommandHandler("mute", mute, pass_args=True) UNMUTE_HANDLER = DisableAbleCommandHandler("unmute", unmute, pass_args=True) TEMPMUTE_HANDLER = DisableAbleCommandHandler(["tmute", "tempmute"], temp_mute, pass_args=True) dispatcher.add_handler(MUTE_HANDLER) dispatcher.add_handler(UNMUTE_HANDLER) dispatcher.add_handler(TEMPMUTE_HANDLER)
parse_mode=ParseMode.MARKDOWN) 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. """ __mod_name__ = "Stickers" STICKERID_HANDLER = CommandHandler("stickerid", stickerid) GETSTICKER_HANDLER = CommandHandler("getsticker", getsticker) KANG_HANDLER = DisableAbleCommandHandler("kang", kang, pass_args=True, admin_ok=True) dispatcher.add_handler(STICKERID_HANDLER) dispatcher.add_handler(GETSTICKER_HANDLER) dispatcher.add_handler(KANG_HANDLER)
@run_async def stats(update, context): update.effective_message.reply_text( # This text doesn't get translated as it is internal message. "*Current Stats:*\n" + "\n".join([mod.__stats__() for mod in STATS]), parse_mode=ParseMode.MARKDOWN) # /ip is for private use __help__ = "misc_help" __mod_name__ = "Misc" ID_HANDLER = DisableAbleCommandHandler("id", get_id, pass_args=True) IP_HANDLER = CommandHandler("ip", get_bot_ip, filters=Filters.chat(OWNER_ID)) PASTE_HANDLER = CommandHandler("paste", paste, pass_args=True) GET_PASTE_HANDLER = CommandHandler("getpaste", get_paste_content, pass_args=True) PASTE_STATS_HANDLER = CommandHandler("pastestats", get_paste_stats, pass_args=True) ECHO_HANDLER = CommandHandler("echo", echo, filters=Filters.user(OWNER_ID)) MD_HELP_HANDLER = CommandHandler("markdownhelp", markdown_help, filters=Filters.private) SUDO_LIST_HANDLER = CommandHandler("sudolist", sudo_list, filters=CustomFilters.sudo_filter) SUPPORT_LIST_HANDLER = CommandHandler("supportlist", support_list, filters=CustomFilters.sudo_filter) STATS_HANDLER = CommandHandler("stats", stats, filters=CustomFilters.sudo_filter) WEEBIFY_HANDLER = DisableAbleCommandHandler("weebify", weebify, pass_args=True) PAT_HANDLER = DisableAbleCommandHandler("pat", pat) SHRUG_HANDLER = DisableAbleCommandHandler(["shrug", "shg"], shrug)
if chat.type == "private": chatname = user.first_name else: chatname = tl(update.effective_message, "current in this chat") currlang = LANGS_TEXT[getlang] if LANGS_TEXT.get(getlang) else "(Deleted langs)" send_message(update.effective_message, tl(msg, "Current language in *{}* is:\n{}.\n\nSelect language:").format(chatname, currlang), parse_mode="markdown", reply_markup=keyboard) @run_async @user_admin_no_reply def button(update, context): query = update.callback_query # type: Optional[CallbackQuery] user = update.effective_user # type: Optional[User] match = re.match(r"set_lang\((.+?)\)", query.data) if match: set_lang = match.group(1) chat = update.effective_chat # type: Optional[Chat] sql.set_lang(chat.id, set_lang) update.effective_message.edit_text(tl(query.message, "Language changed to {}!").format(LANGS_TEXT.get(set_lang))) __help__ = "language_help" __mod_name__ = "Languages" SETLANG_HANDLER = DisableAbleCommandHandler("setlang", set_language) CALLBACK_QUERY_HANDLER = CallbackQueryHandler(button, pattern=r"set_lang") dispatcher.add_handler(SETLANG_HANDLER) dispatcher.add_handler(CALLBACK_QUERY_HANDLER)
if valid: if not reason: res = tl(update.effective_message, "{} is AFK!").format(fst_name) else: res = tl(update.effective_message, "{} is AFK! says its because of: {}").format( fst_name, reason) send_message(update.effective_message, res) __help__ = "afk_help" __mod_name__ = "AFK" AFK_HANDLER = DisableAbleCommandHandler("afk", afk) AFK_REGEX_HANDLER = DisableAbleMessageHandler(Filters.regex("(?i)brb"), afk, friendly="afk") NO_AFK_HANDLER = MessageHandler( Filters.all & Filters.group & ~Filters.update.edited_message, no_longer_afk) AFK_REPLY_HANDLER = MessageHandler(Filters.all & Filters.group, reply_afk) # AFK_REPLY_HANDLER = MessageHandler(Filters.entity(MessageEntity.MENTION) | Filters.entity(MessageEntity.TEXT_MENTION), # 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)
base_string = "Current <b>blacklisted</b> domains:\n" blacklisted = sql.get_blacklisted_urls(chat.id) if not blacklisted: message.reply_text("There are no blacklisted domains here!") return for domain in blacklisted: base_string += "- <code>{}</code>\n".format(domain) message.reply_text(base_string, parse_mode=ParseMode.HTML) URL_BLACKLIST_HANDLER = DisableAbleCommandHandler("blacklist", add_blacklist_url, filters=Filters.group, pass_args=True, admin_ok=True) ADD_URL_BLACKLIST_HANDLER = CommandHandler("addurl", add_blacklist_url, filters=Filters.group) RM_BLACKLIST_URL_HANDLER = CommandHandler("delurl", rm_blacklist_url, filters=Filters.group) GET_BLACKLISTED_URLS = CommandHandler("geturl", get_blacklisted_urls, filters=Filters.group) URL_DELETE_HANDLER = MessageHandler(Filters.entity("url"), del_blacklist_url) __mod_name__ = "Domain Blacklists"
disable_web_page_preview=False) progress_message.delete() else: query.answer("You are not allowed to use this.") __help__ = """ Get information about anime, manga or characters from [MyAnimeList](https://myanimelist.net). *Available commands:* - /anime <anime>: returns information about the anime. - /character <character>: returns information about the character. - /manga <manga>: returns information about the manga. - /upcoming: returns a list of new anime in the upcoming seasons. """ __mod_name__ = "MyAnimeList" ANIME_HANDLER = DisableAbleCommandHandler("anime", anime) CHARACTER_HANDLER = DisableAbleCommandHandler("character", character) MANGA_HANDLER = DisableAbleCommandHandler("manga", manga) UPCOMING_HANDLER = DisableAbleCommandHandler("upcoming", upcoming) 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(UPCOMING_HANDLER)
result = [] result.append(' '.join([s for s in data])) for pos, symbol in enumerate(data[1:]): result.append(symbol + ' ' + ' ' * pos + symbol) result = list("\n".join(result)) result[0] = data[0] result = "".join(result) msg = "```\n" + result + "```" return update.effective_message.reply_text(msg, parse_mode="MARKDOWN") __help__ = "memes_help" __mod_name__ = "Memes and etc." COPYPASTA_HANDLER = DisableAbleCommandHandler("cp", copypasta, pass_args=True) CLAPMOJI_HANDLER = DisableAbleCommandHandler("clap", clapmoji, pass_args=True) BMOJI_HANDLER = DisableAbleCommandHandler("bify", bmoji, pass_args=True) MOCK_HANDLER = DisableAbleCommandHandler("mock", spongemocktext, pass_args=True) OWO_HANDLER = DisableAbleCommandHandler("owo", owo, pass_args=True) STRETCH_HANDLER = DisableAbleCommandHandler("stretch", stretch, pass_args=True) VAPOR_HANDLER = DisableAbleCommandHandler("vapor", vapor, pass_args=True) ZALGO_HANDLER = DisableAbleCommandHandler("zalgofy", zalgotext, pass_args=True) SHOUT_HANDLER = DisableAbleCommandHandler("shout", shout, pass_args=True) CHINESEMEMES_HANDLER = DisableAbleCommandHandler("dllm", chinesememes, pass_args=True) DEEPFRY_HANDLER = DisableAbleCommandHandler("deepfry", deepfryer,
def __migrate__(old_chat_id, new_chat_id): sql.migrate_chat(old_chat_id, new_chat_id) def __chat_settings__(chat_id, user_id): num_warn_filters = sql.num_warn_chat_filters(chat_id) limit, soft_warn, warn_mode = sql.get_warn_setting(chat_id) return tl(user_id, "Obrolan ini mempunyai `{}` saringan peringatkan. Dibutuhkan `{}` peringatan " \ "sebelum pengguna akan mendapatkan *{}*.").format(num_warn_filters, limit, "tendangan" if soft_warn else "pemblokiran") __help__ = "warns_help" __mod_name__ = "Warnings" WARN_HANDLER = DisableAbleCommandHandler( "warn", warn_user, pass_args=True) #, filters=Filters.group) RESET_WARN_HANDLER = CommandHandler(["resetwarn", "resetwarns", "rmwarn"], reset_warns, pass_args=True) #, filters=Filters.group) CALLBACK_QUERY_HANDLER = CallbackQueryHandler(button, pattern=r"rm_warn") MYWARNS_HANDLER = DisableAbleCommandHandler( "warns", warns, pass_args=True) #, 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)
sql.update_restriction(chat_id, itemlock, locked=True) else: pass 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_lock_message(chat_id) __help__ = "locks_help" __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) LOCKWARNS_HANDLER = CommandHandler("lockwarns", lock_warns, pass_args=True) dispatcher.add_handler(LOCK_HANDLER) dispatcher.add_handler(UNLOCK_HANDLER) dispatcher.add_handler(LOCKTYPES_HANDLER) dispatcher.add_handler(LOCKED_HANDLER) dispatcher.add_handler(LOCKWARNS_HANDLER) dispatcher.add_handler(MessageHandler(Filters.all & Filters.group, del_lockables), PERM_GROUP)
sql.migrate_chat(old_chat_id, new_chat_id) def __chat_settings__(chat_id, user_id): notes = sql.get_all_chat_notes(chat_id) return tl(user_id, "There are `{}` notes in this chat.").format(len(notes)) __help__ = "notes_help" __mod_name__ = "Notes" GET_HANDLER = CommandHandler("get", cmd_get, pass_args=True) HASH_GET_HANDLER = MessageHandler(Filters.regex(r"^#[^\s]+"), hash_get) SAVE_HANDLER = CommandHandler("save", save) DELETE_HANDLER = CommandHandler("clear", clear, pass_args=True) PMNOTE_HANDLER = CommandHandler("privatenote", private_note, pass_args=True) LIST_HANDLER = DisableAbleCommandHandler(["notes", "saved"], list_notes, admin_ok=True) dispatcher.add_handler(GET_HANDLER) dispatcher.add_handler(SAVE_HANDLER) dispatcher.add_handler(LIST_HANDLER) dispatcher.add_handler(DELETE_HANDLER) dispatcher.add_handler(PMNOTE_HANDLER) dispatcher.add_handler(HASH_GET_HANDLER)