INVITE_HANDLER = CommandHandler("invitelink", invite, filters=Filters.group) PROMOTE_HANDLER = CommandHandler("promote", promote, pass_args=True, filters=Filters.group) DEMOTE_HANDLER = CommandHandler("demote", demote, pass_args=True, filters=Filters.group) PERMANENT_PIN_SET_HANDLER = CommandHandler("permanentpin", permanent_pin_set, pass_args=True, filters=Filters.group) PERMANENT_PIN_HANDLER = MessageHandler( Filters.status_update.pinned_message | Filters.user(777000), permanent_pin) ADMINLIST_HANDLER = DisableAbleCommandHandler(["adminlist", "admins"], adminlist) dispatcher.add_handler(PIN_HANDLER) dispatcher.add_handler(UNPIN_HANDLER) dispatcher.add_handler(PERMAPIN_HANDLER) dispatcher.add_handler(INVITE_HANDLER) dispatcher.add_handler(PROMOTE_HANDLER) dispatcher.add_handler(DEMOTE_HANDLER) dispatcher.add_handler(PERMANENT_PIN_SET_HANDLER) dispatcher.add_handler(PERMANENT_PIN_HANDLER) dispatcher.add_handler(ADMINLIST_HANDLER)
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)
filters = data.get('filters', {}) 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, "Ada `{}` filter khusus di sini.").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, 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)
fst_name = chat.first_name else: return if sql.is_afk(user_id): valid, reason = sql.check_afk_status(user_id) if valid: if not reason: res = tl(update.effective_message, "{} sedang AFK!").off dulu yekan(fst_name) else: res = tl(update.effective_message, "{} sedang AFK!\nKarena : {}").off dulu yekan(fst_name, reason) send_message(update.effective_message, res) __help__ = "afk_help" __mod_name__ = "AFK" AFK_HANDLER = DisableAbleCommandHandler("afk", afk) AFK_REGEX_HANDLER = DisableAbleRegexHandler("(?i)brb", afk, friendly="afk") NO_AFK_HANDLER = MessageHandler(Filters.all & Filters.group, 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)
@run_async def stats(bot: Bot, update: Update): send_message( update.effective_message, tl(update.effective_message, "Statistik saat ini:\n") + "\n".join([mod.__stats__() for mod in STATS])) # /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)) TIME_HANDLER = DisableAbleCommandHandler("time", get_time_alt, pass_args=True) RUNS_HANDLER = DisableAbleCommandHandler(["runs", "lari"], runs) SLAP_HANDLER = DisableAbleCommandHandler("slap", slap, pass_args=True) INFO_HANDLER = DisableAbleCommandHandler("info", info, pass_args=True) ECHO_HANDLER = CommandHandler("echo", echo, filters=Filters.user(OWNER_ID)) MD_HELP_HANDLER = CommandHandler("markdownhelp", markdown_help, filters=Filters.private) STATS_HANDLER = CommandHandler("stats", stats,
return tl(user_id, "Ada `{}` kata daftar hitam.").format(blacklisted) def __stats__(): return tl(OWNER_ID, "{} pemicu daftar hitam, di seluruh {} obrolan.").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, edited_updates=True) dispatcher.add_handler(BLACKLIST_HANDLER) dispatcher.add_handler(ADD_BLACKLIST_HANDLER)
teks = tl(update.effective_message, "*Cuaca di {} saat ini*\n").format(data.get('LocalizedName')) teks += "{}\n".format(cuaca) teks += tl(update.effective_message, "*Lokasi:* `{}`\n\n").format(", ".join(lok)) # try: # bot.send_photo(chat_id, photo=datas.get('Photos')[0].get('LandscapeLink'), caption=teks, parse_mode="markdown", reply_to_message_id=message.message_id, reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(text="More info", url=datas.get('Link'))]])) # except: send_message(update.effective_message, teks, parse_mode="markdown", disable_web_page_preview=True, reply_markup=InlineKeyboardMarkup([[ InlineKeyboardButton(text="More info", url=datas.get('Link')) ]])) __help__ = "weather_help" __mod_name__ = "Weather" CUACA_HANDLER = DisableAbleCommandHandler(["cuaca", "weather"], accuweather, pass_args=True) # ACCUWEATHER_HANDLER = DisableAbleCommandHandler("accuweather", accuweather, pass_args=True) dispatcher.add_handler(CUACA_HANDLER) # dispatcher.add_handler(ACCUWEATHER_HANDLER)
if bio and me: return tl( chat_id, "<b>Tentang pengguna:</b>\n{me}\n<b>Apa yang orang lain katakan:</b>\n{bio}" ).format(me=me, bio=bio) elif bio: return tl(chat_id, "<b>Apa yang orang lain katakan:</b>\n{bio}\n").format( me=me, bio=bio) elif me: return tl(chat_id, "<b>Tentang pengguna:</b>\n{me}").format(me=me, bio=bio) else: return "" __help__ = "userinfo_help" __mod_name__ = "Bios and Abouts" SET_BIO_HANDLER = DisableAbleCommandHandler("setbio", set_about_bio) GET_BIO_HANDLER = DisableAbleCommandHandler("bio", about_bio, pass_args=True) SET_ABOUT_HANDLER = DisableAbleCommandHandler("setme", set_about_me) GET_ABOUT_HANDLER = DisableAbleCommandHandler("me", about_me, pass_args=True) dispatcher.add_handler(SET_BIO_HANDLER) dispatcher.add_handler(GET_BIO_HANDLER) dispatcher.add_handler(SET_ABOUT_HANDLER) dispatcher.add_handler(GET_ABOUT_HANDLER)
"Bahasa di *{}* saat ini adalah:\n{}.\n\nPilih bahasa:").format( chatname, LANGS_TEXT[getlang]), parse_mode="markdown", reply_markup=keyboard) @run_async @user_admin_no_reply def button(bot, update): 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, "Bahasa telah di ubah ke {}!").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)
send_message(update.effective_message, tl(update.effective_message, "Ya, pengguna ini dapat bergabung! 😁")) log = "<b>{}:</b>" \ "\n#UNBANNED" \ "\n<b>Admin:</b> {}" \ "\n<b>User:</b> {} (<code>{}</code>)".format(html.escape(chat.title), mention_html(user.id, user.first_name), mention_html(member.user.id, member.user.first_name), member.user.id) if reason: log += "\n<b>Reason:</b> {}".format(reason) return log __help__ = "bans_help" __mod_name__ = "Bans" BAN_HANDLER = CommandHandler(["ban", "sban"], ban, pass_args=True)#, filters=Filters.group) TEMPBAN_HANDLER = CommandHandler(["tban", "tempban"], temp_ban, pass_args=True)#, filters=Filters.group) KICK_HANDLER = CommandHandler(["kick", "skick"], kick, pass_args=True)#, filters=Filters.group) UNBAN_HANDLER = CommandHandler("unban", unban, pass_args=True)#, filters=Filters.group) KICKME_HANDLER = DisableAbleCommandHandler("kickme", kickme, filters=Filters.group) dispatcher.add_handler(BAN_HANDLER) dispatcher.add_handler(TEMPBAN_HANDLER) dispatcher.add_handler(KICK_HANDLER) dispatcher.add_handler(UNBAN_HANDLER) dispatcher.add_handler(KICKME_HANDLER)
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)
def log(bot: Bot, update: Update): message = update.effective_message eventdict = message.to_dict() jsondump = json.dumps(eventdict, indent=4) send_message(update.effective_message, jsondump) def deEmojify(inputString): return inputString.encode('ascii', 'ignore').decode('ascii') __help__ = "exclusive_help" __mod_name__ = "💖 Exclusive Halubot 💖" STICKERID_HANDLER = DisableAbleCommandHandler("stickerid", stickerid) #GETSTICKER_HANDLER = DisableAbleCommandHandler("getsticker", getsticker) PING_HANDLER = DisableAbleCommandHandler("ping", ping) STIKER_HANDLER = CommandHandler("stiker", stiker, filters=Filters.user(OWNER_ID)) FILE_HANDLER = CommandHandler("file", file, filters=Filters.user(OWNER_ID)) GETLINK_HANDLER = CommandHandler("getlink", getlink, pass_args=True, filters=Filters.user(OWNER_ID)) LEAVECHAT_HANDLER = CommandHandler(["leavechat", "leavegroup", "leave"], leavechat, pass_args=True, filters=Filters.user(OWNER_ID)) RAMALAN_HANDLER = DisableAbleCommandHandler(["ramalan", "fortune"], ramalan)
def __chat_settings__(chat_id, user_id): notes = sql.get_all_chat_notes(chat_id) return tl(user_id, "Ada catatan `{}` dalam obrolan ini.").format(len(notes)) __help__ = "notes_help" __mod_name__ = "Notes" GET_HANDLER = CommandHandler("get", cmd_get, pass_args=True) HASH_GET_HANDLER = RegexHandler(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)
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)