__help__ = """ We're all busy people who don't have time to monitor our groups 24/7. But how do you \ react if someone in your group is spamming? Presenting reports; if someone in your group thinks someone needs reporting, they now have \ an easy way to call all admins. *Admin only:* ➩ /reports <on/off>: Change report setting, or view current status. • If done in pm, toggles your status. • If in chat, toggles that chat's status. To report a user, simply reply to user's message with @admin or /report. \ This message tags all the chat admins; same as if they had been @'ed. You MUST reply to a message to report a user; you can't just use @admin to tag admins for no reason! Note that the report commands do not work when admins use them; or when used to report an admin. Bot assumes that \ admins don't need to report, or be reported! """ REPORT_HANDLER = CommandHandler("report", report, filters=Filters.group) SETTING_HANDLER = CommandHandler("reports", report_setting, pass_args=True) ADMIN_REPORT_HANDLER = MessageHandler(Filters.regex("(?i)@admin(s)?"), report) REPORT_BUTTON_HANDLER = CallbackQueryHandler(report_buttons, pattern=r"report_") dispatcher.add_handler(REPORT_HANDLER, REPORT_GROUP) dispatcher.add_handler(ADMIN_REPORT_HANDLER, REPORT_GROUP) dispatcher.add_handler(SETTING_HANDLER) dispatcher.add_handler(REPORT_BUTTON_HANDLER)
➩ /info: Get information about a user. ➩ /id: Get the current group id. If used by replying to a message, gets that user's id. ➩ /afk <reason>: Mark yourself as AFK. ➩ brb <reason>: Same as the afk command - but not a command. ➩ /setbio <text>: While replying, will save another user's bio ➩ /bio: Will get your or another user's bio. This cannot be set by yourself. ➩ /setme <text>: Will set your info ➩ /me: Will get your or another user's info An example of setting a bio for yourself: `/setme I work for Telegram`; Bio is set to yourself. An example of writing someone else' bio: Reply to user's message: `/setbio He is such cool person`. *Notice:* Do not use /setbio against yourself! """ __mod_name__ = "⚜ INFO ⚜" 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)
`/save notename` while replying to a sticker or whatever data you'd like. Now, the note at "#notename" contains a sticker which will be sent as a reply. Tip: to retrieve a note without the formatting, use /get <notename> noformat This will retrieve the note and send it without formatting it; getting you the raw markdown, allowing you to make easy edits. """ __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) LIST_HANDLER = DisableAbleCommandHandler(["notes", "saved"], list_notes, admin_ok=True) CLEARALLNOTES_HANDLER = CommandHandler("rmallnotes", clear_notes, filters=Filters.group) RMBTN_HANDLER = CallbackQueryHandler(rmbutton, pattern=r"rmnotes_") dispatcher.add_handler(GET_HANDLER) dispatcher.add_handler(SAVE_HANDLER) dispatcher.add_handler(LIST_HANDLER) dispatcher.add_handler(DELETE_HANDLER) dispatcher.add_handler(HASH_GET_HANDLER) dispatcher.add_handler(CLEARALLNOTES_HANDLER) dispatcher.add_handler(RMBTN_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. ➩ /rmblacklist <triggers>: Same as above. ➩ /blacklistmode <off/del/warn/ban/kick/mute/tban/tmute>: Action to perform when someone sends blacklisted words. """ __mod_name__ = "B LIST" 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) dispatcher.add_handler(BLACKLIST_DEL_HANDLER, group=BLACKLIST_GROUP)
remove_warns, pass_args=True, filters=Filters.group) CALLBACK_QUERY_HANDLER = CallbackQueryHandler(button, pattern=r"rm_warn") MYWARNS_HANDLER = DisableAbleCommandHandler("warns", warns, pass_args=True) ADD_WARN_HANDLER = CommandHandler("addwarn", add_warn_filter) RM_WARN_HANDLER = CommandHandler(["nowarn", "stopwarn"], remove_warn_filter) LIST_WARN_HANDLER = DisableAbleCommandHandler(["warnlist", "warnfilters"], list_warn_filters, admin_ok=True) WARN_FILTER_HANDLER = MessageHandler(CustomFilters.has_text & Filters.group, reply_filter) WARN_LIMIT_HANDLER = CommandHandler("warnlimit", set_warn_limit, pass_args=True) WARN_STRENGTH_HANDLER = CommandHandler("strongwarn", set_warn_strength, pass_args=True) dispatcher.add_handler(WARN_HANDLER) dispatcher.add_handler(CALLBACK_QUERY_HANDLER) dispatcher.add_handler(RESET_WARN_HANDLER) dispatcher.add_handler(REMOVE_WARNS_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)
TITSGIF_HANDLER = DisableAbleCommandHandler("titsgif", titsgif) ERO_HANDLER = DisableAbleCommandHandler("ero", ero) SMUG_HANDLER = DisableAbleCommandHandler("smug", smug) BAKA_HANDLER = DisableAbleCommandHandler("baka", baka) DVA_HANDLER = DisableAbleCommandHandler("dva", dva) #NEKO_REGEX_HANDLER = DisableAbleMessageHandler(Filters.regex(r"^+neko(.*)$"), neko, friendly="neko") #TICKLE_REGEX_HANDLER = DisableAbleMessageHandler(Filters.regex(r"^+tickle(.*)$"), tickle, friendly="tickle") #FEED_REGEX_HANDLER = DisableAbleMessageHandler(Filters.regex(r"^+feed(.*)$"), feed, friendly="feed") #POKE_REGEX_HANDLER = DisableAbleMessageHandler(Filters.regex(r"^+poke(.*)$"), poke, friendly="poke") #WAIFU_REGEX_HANDLER = DisableAbleMessageHandler(Filters.regex(r"^+waifu(.*)$"), waifu, friendly="waifu") #KISS_REGEX_HANDLER = DisableAbleMessageHandler(Filters.regex(r"^+kiss(.*)$"), kiss, friendly="kiss") #CUDDLE_REGEX_HANDLER = DisableAbleMessageHandler(Filters.regex(r"^+hug(.*)$"), hug, friendly="hug") #SMUG_REGEX_HANDLER = DisableAbleMessageHandler(Filters.regex(r"^+smug(.*)$"), smug, friendly="smug") #BAKA_REGEX_HANDLER = DisableAbleMessageHandler(Filters.regex(r"^+baka(.*)$"), baka, friendly="baka") 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)
UNGBAN_HANDLER = CommandHandler( "ungban", ungban, pass_args=True, filters=CustomFilters.support_filter, run_async=True, ) GBAN_LIST = CommandHandler( "gbanlist", gbanlist, filters=CustomFilters.support_filter, run_async=True ) GBAN_STATUS = CommandHandler( "spamshield", gbanstat, pass_args=True, filters=Filters.chat_type.groups, run_async=True, ) GBAN_ENFORCER = MessageHandler( Filters.all & Filters.chat_type.groups, enforce_gban, run_async=True ) dispatcher.add_handler(GBAN_HANDLER) dispatcher.add_handler(UNGBAN_HANDLER) dispatcher.add_handler(GBAN_LIST) dispatcher.add_handler(GBAN_STATUS) if STRICT_GBAN: # enforce GBANS if this is set dispatcher.add_handler(GBAN_ENFORCER, GBAN_ENFORCE_GROUP)
⚙️ *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. (tmute seems broken right now) 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)
__help__ = """ Recent actions are nice, but they don't help you log every action taken by the bot. This is why you need log channels! Log channels can help you keep track of exactly what the other admins are doing. \ Bans, Mutes, warns, notes - everything can be moderated. *Admin only:* ➩ /logchannel: Get log channel info ➩ /setlog: Set the log channel. ➩ /unsetlog: Unset the log channel. Setting the log channel is done by: ➩ Add the bot to your channel, as an admin. This is done via the "add administrators" tab. ➩ Send /setlog to your channel. ➩ Forward the /setlog command to the group you wish to be logged. ➩ Congratulations! All is set! """ __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
import random from telegram.ext import run_async, Filters from telegram import Message, Chat, Update, Bot, MessageEntity from Elizabeth import dispatcher from Elizabeth.modules.disable import DisableAbleCommandHandler TR_STRINGS = ( "Bu dünyada götürülecek hiçbir şey yok ... sadece aşk ve arkadaşlıktan vazgeçilecek😉😉🙃.Bu dünyada götürülecek hiçbir şey yok ... sadece aşk ve arkadaşlıktan vazgeçilecek😉😉🙃", "Bazı insanlar en sevilen olduğumuzu düşünse de ...... aşkımızın başkaları için olduğunu anlasınlar, bizi arayın .... çok üzücü ................ sonsuza kadar ...... .... Ep ", ) @run_async qt q(bot: Bot, update: Update): bot.sendChatAction(update.effective_chat.id, "typing") # Bot typing before send messages message = update.effective_message if message.reply_to_message: message.reply_to_message.reply_text(random.choice(TR_STRINGS)) else: message.reply_text(random.choice(TR_STRINGS)) __help__ = """ - /qt""" __mod_name__ = "T- Quotes" Q_HANDLER = DisableAbleCommandHandler("qt", qt) dispatcher.add_handler(Q_HANDLER)
text = re.sub(repl, repl_with, to_fix, count=1, flags=re.I).strip() elif "g" in flags: text = re.sub(repl, repl_with, to_fix).strip() else: text = re.sub(repl, repl_with, to_fix, count=1).strip() except sre_constants.error: LOGGER.warning(update.effective_message.text) LOGGER.exception("SRE constant error") update.effective_message.reply_text( "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) SED_HANDLER = DisableAbleMessageHandler( Filters.regex(r"s([{}]).*?\1.*".format("".join(DELIMITERS))), sed, friendly="sed", run_async=True, ) dispatcher.add_handler(SED_HANDLER)
yesnowtf, run_async=True) GDMORNING_HANDLER = DisableAbleMessageHandler( Filters.regex(r"(?i)(good morning)"), goodmorning, friendly="goodmorning", run_async=True, ) GDNIGHT_HANDLER = DisableAbleMessageHandler( Filters.regex(r"(?i)(good night)"), goodnight, friendly="goodnight", run_async=True, ) dispatcher.add_handler(POLICE_HANDLER) dispatcher.add_handler(SHRUG_HANDLER) dispatcher.add_handler(DECIDE_HANDLER) dispatcher.add_handler(ABUSE_HANDLER) dispatcher.add_handler(SNIPE_HANDLER) dispatcher.add_handler(RUNS_HANDLER) dispatcher.add_handler(SLAP_HANDLER) dispatcher.add_handler(PUNCH_HANDLER) dispatcher.add_handler(HUG_HANDLER) dispatcher.add_handler(GBUN_HANDLER) dispatcher.add_handler(TABLE_HANDLER) dispatcher.add_handler(RECITE_HANDLER) dispatcher.add_handler(CRI_HANDLER) dispatcher.add_handler(PASTA_HANDLER) dispatcher.add_handler(CLAP_HANDLER) dispatcher.add_handler(OWO_HANDLER)
parse_mode="html") sleep(10) replafk.delete() def __gdpr__(user_id): sql.rm_afk(user_id) AFK_HANDLER = DisableAbleCommandHandler("afk", afk) AFK_REGEX_HANDLER = DisableAbleMessageHandler(Filters.regex("(?i)brb"), afk, friendly="afk") NO_AFK_HANDLER = MessageHandler(Filters.all & Filters.group, no_longer_afk) AFK_REPLY_HANDLER = MessageHandler( Filters.all & Filters.group & ~Filters.update.edited_message, 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__ = "afk" __command_list__ = ["afk"] __handlers__ = [ (AFK_HANDLER, AFK_GROUP), (AFK_REGEX_HANDLER, AFK_GROUP), (NO_AFK_HANDLER, AFK_GROUP), (AFK_REPLY_HANDLER, AFK_REPLY_GROUP), ]
def __chat_settings__(chat_id, user_id): return "This chat has had it's rules set: `{}`".format( bool(sql.get_rules(chat_id))) __help__ = """ Every chat works with different rules; this module will help make those rules clearer! × /rules: get the rules for this chat. *Admin only:* × /setrules <your rules here>: Sets rules for the chat. × /clearrules: Clears saved rules for the 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)
*Admin only*: ➩ /setflood <int/'no'/'off'>: enables or disables flood control ➩ /setfloodmode <ban/kick/mute/tban/tmute> <value>: Action to perform when user have exceeded flood limit. ban/kick/mute/tmute/tban Note: - Value must be filled for tban and tmute! It can be: 5m = 5 minutes 6h = 6 hours 3d = 3 days 1w = 1 week """ __mod_name__ = "FLOOD" FLOOD_BAN_HANDLER = MessageHandler( Filters.all & ~Filters.status_update & Filters.group, check_flood) SET_FLOOD_HANDLER = CommandHandler("setflood", set_flood, pass_args=True) # , filters=Filters.group) SET_FLOOD_MODE_HANDLER = CommandHandler( "setfloodmode", set_flood_mode, pass_args=True) # , filters=Filters.group) FLOOD_HANDLER = CommandHandler("flood", flood) # , filters=Filters.group) dispatcher.add_handler(FLOOD_BAN_HANDLER, FLOOD_GROUP) dispatcher.add_handler(SET_FLOOD_HANDLER) dispatcher.add_handler(SET_FLOOD_MODE_HANDLER) dispatcher.add_handler(FLOOD_HANDLER)
UD_HANDLER = DisableAbleCommandHandler("ud", ud, run_async=True) GETLINK_HANDLER = CommandHandler( "getlink", getlink, pass_args=True, filters=CustomFilters.dev_filter, run_async=True, ) STAFFLIST_HANDLER = CommandHandler("staffids", staff_ids, filters=Filters.user(OWNER_ID), run_async=True) # SRC_HANDLER = CommandHandler("source", src, filters=Filters.private) COVID_HANDLER = CommandHandler("covid", covid, run_async=True) PASTE_HANDLER = CommandHandler("paste", paste, run_async=True) dispatcher.add_handler(WALLPAPER_HANDLER) dispatcher.add_handler(UD_HANDLER) dispatcher.add_handler(ID_HANDLER) dispatcher.add_handler(INFO_HANDLER) dispatcher.add_handler(ECHO_HANDLER) dispatcher.add_handler(MD_HELP_HANDLER) dispatcher.add_handler(STATS_HANDLER) dispatcher.add_handler(GDPR_HANDLER) dispatcher.add_handler(WIKI_HANDLER) dispatcher.add_handler(GETLINK_HANDLER) dispatcher.add_handler(STAFFLIST_HANDLER) # dispatcher.add_handler(SRC_HANDLER) dispatcher.add_handler(COVID_HANDLER) dispatcher.add_handler(PASTE_HANDLER)
This allows you to disable some commonly used commands, so noone can use them. \ It'll also allow you to autodelete them, stopping people from bluetexting. ➩ /cmds: Check the current status of disabled commands *Admin only:* ➩ /enable <cmd name>: Enable that command ➩ /disable <cmd name>: Disable that command ➩ /listcmds: List all possible disablable commands """ __mod_name__ = "DISABLE" DISABLE_HANDLER = CommandHandler( "disable", disable, pass_args=True) # , filters=Filters.group) ENABLE_HANDLER = CommandHandler("enable", enable, pass_args=True) # , filters=Filters.group) COMMANDS_HANDLER = CommandHandler(["cmds", "disabled"], commands) # , filters=Filters.group) # , filters=Filters.group) TOGGLE_HANDLER = CommandHandler("listcmds", list_cmds) dispatcher.add_handler(DISABLE_HANDLER) dispatcher.add_handler(ENABLE_HANDLER) dispatcher.add_handler(COMMANDS_HANDLER) dispatcher.add_handler(TOGGLE_HANDLER) else: DisableAbleCommandHandler = CommandHandler DisableAbleMessageHandler = MessageHandler
def fahr(c): c1 = 9 / 5 c2 = 459.67 tF = c * c1 - c2 if tF < 0 and tF > -1: tF = 0 temp = str(round(tF)) return temp reply = f"*Current weather for {cityname}, {country_name} is*:\n\n*Temperature:* `{celsius(curtemp)}°C ({fahr(curtemp)}ºF), feels like {celsius(feels_like)}°C ({fahr(feels_like)}ºF) \n`*Condition:* `{condmain}, {conddet}` {icon}\n*Humidity:* `{humidity}%`\n*Wind:* `{kmph[0]} km/h`\n" del_msg = update.effective_message.reply_text( "{}".format(reply), parse_mode=ParseMode.MARKDOWN, disable_web_page_preview=True) time.sleep(30) try: del_msg.delete() update.effective_message.delete() except BadRequest as err: if (err.message == "Message to delete not found") or ( err.message == "Message can't be deleted"): return __mod_name__ = "🌨Weather🌨" WEATHER_HANDLER = DisableAbleCommandHandler("weather", weather, pass_args=True) dispatcher.add_handler(WEATHER_HANDLER)
parse_mode=ParseMode.MARKDOWN, disable_web_page_preview=True, ) return elif fetch.status_code == 404: message.reply_text( "`Couldn't reach api`", parse_mode=ParseMode.MARKDOWN, disable_web_page_preview=True, ) return __mod_name__ = "Android" MAGISK_HANDLER = DisableAbleCommandHandler("magisk", magisk) DEVICE_HANDLER = DisableAbleCommandHandler("device", device, pass_args=True) TWRP_HANDLER = DisableAbleCommandHandler("twrp", twrp, pass_args=True) LOS_HANDLER = DisableAbleCommandHandler("los", los, pass_args=True) BOOTLEG_HANDLER = DisableAbleCommandHandler("bootleg", bootleg, pass_args=True) GSI_HANDLER = DisableAbleCommandHandler("gsi", gsi, pass_args=True) dispatcher.add_handler(MAGISK_HANDLER) dispatcher.add_handler(DEVICE_HANDLER) dispatcher.add_handler(TWRP_HANDLER) dispatcher.add_handler(LOS_HANDLER) dispatcher.add_handler(GSI_HANDLER) dispatcher.add_handler(BOOTLEG_HANDLER)
PING_HANDLER = CommandHandler( "ping", ping, filters=CustomFilters.sudo_filter, run_async=True ) SPEED_HANDLER = CommandHandler( "speedtest", speedtst, filters=CustomFilters.sudo_filter, run_async=True ) SYS_STATUS_HANDLER = CommandHandler( "sysinfo", system_status, filters=CustomFilters.dev_filter, run_async=True ) LEAVECHAT_HANDLER = CommandHandler( ["leavechat", "leavegroup", "leave"], leavechat, pass_args=True, filters=CustomFilters.dev_filter, run_async=True, ) GITPULL_HANDLER = CommandHandler( "gitpull", gitpull, filters=CustomFilters.dev_filter, run_async=True ) RESTART_HANDLER = CommandHandler( "reboot", restart, filters=CustomFilters.dev_filter, run_async=True ) dispatcher.add_handler(IP_HANDLER) dispatcher.add_handler(SPEED_HANDLER) dispatcher.add_handler(PING_HANDLER) dispatcher.add_handler(SYS_STATUS_HANDLER) dispatcher.add_handler(LEAVECHAT_HANDLER) dispatcher.add_handler(GITPULL_HANDLER) dispatcher.add_handler(RESTART_HANDLER)
temp_ban, pass_args=True, filters=Filters.chat_type.groups, run_async=True, ) KICK_HANDLER = CommandHandler("kick", kick, pass_args=True, filters=Filters.chat_type.groups, run_async=True) UNBAN_HANDLER = CommandHandler("unban", unban, pass_args=True, filters=Filters.chat_type.groups, run_async=True) KICKME_HANDLER = DisableAbleCommandHandler("kickme", kickme, filters=Filters.chat_type.groups, run_async=True) BANME_HANDLER = DisableAbleCommandHandler("banme", banme, filters=Filters.chat_type.groups, run_async=True) 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) dispatcher.add_handler(BANME_HANDLER)
× /allowconnect <yes/no>: allow a user to connect to a chat """ CONNECT_CHAT_HANDLER = CommandHandler("connect", connect_chat, pass_args=True, run_async=True) CONNECTION_CHAT_HANDLER = CommandHandler("connection", connection_chat, run_async=True) DISCONNECT_CHAT_HANDLER = CommandHandler("disconnect", disconnect_chat, run_async=True) ALLOW_CONNECTIONS_HANDLER = CommandHandler("allowconnect", allow_connections, pass_args=True, run_async=True) HELP_CONNECT_CHAT_HANDLER = CommandHandler("helpconnect", help_connect_chat, run_async=True) CONNECT_BTN_HANDLER = CallbackQueryHandler(connect_button, pattern=r"connect", run_async=True) 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)
filters=Filters.group) WELCOMEMUTE_HANDLER = CommandHandler("welcomemute", welcomemute, filters=Filters.group) CLEAN_SERVICE_HANDLER = CommandHandler("cleanservice", cleanservice, filters=Filters.group) CLEAN_WELCOME = CommandHandler("cleanwelcome", clean_welcome, filters=Filters.group) WELCOME_HELP = CommandHandler("welcomehelp", welcome_help) WELCOME_MUTE_HELP = CommandHandler("welcomemutehelp", welcome_mute_help) BUTTON_VERIFY_HANDLER = CallbackQueryHandler(user_button, pattern=r"user_join_") dispatcher.add_handler(NEW_MEM_HANDLER) dispatcher.add_handler(LEFT_MEM_HANDLER) dispatcher.add_handler(WELC_PREF_HANDLER) dispatcher.add_handler(GOODBYE_PREF_HANDLER) dispatcher.add_handler(SET_WELCOME) dispatcher.add_handler(SET_GOODBYE) dispatcher.add_handler(RESET_WELCOME) dispatcher.add_handler(RESET_GOODBYE) dispatcher.add_handler(CLEAN_WELCOME) dispatcher.add_handler(WELCOME_HELP) dispatcher.add_handler(WELCOMEMUTE_HANDLER) dispatcher.add_handler(CLEAN_SERVICE_HANDLER) dispatcher.add_handler(BUTTON_VERIFY_HANDLER) dispatcher.add_handler(WELCOME_MUTE_HELP) __mod_name__ = "Greetings"
text=msg.text) res = requests.get(URL, params=params) changes = json.loads(res.text).get("LightGingerTheTextResult") curr_string = "" prev_end = 0 for change in changes: start = change.get("From") end = change.get("To") + 1 suggestions = change.get("Suggestions") if suggestions: # should look at this list more sugg_str = suggestions[0].get("Text") curr_string += msg.text[prev_end:start] + sugg_str prev_end = end curr_string += msg.text[prev_end:] update.effective_message.reply_text(curr_string) else: update.effective_message.reply_text( "Reply to some message to get grammar corrected text!") __mod_name__ = "Translate" dispatcher.add_handler( DisableAbleCommandHandler(["tr", "tl"], gtrans, pass_args=True)) dispatcher.add_handler(DisableAbleCommandHandler("tts", gtts, pass_args=True)) dispatcher.add_handler(DisableAbleCommandHandler("spell", spellcheck))
PROMOTE_HANDLER = CommandHandler("promote", promote, pass_args=True, filters=Filters.group) DEMOTE_HANDLER = CommandHandler("demote", demote, pass_args=True, filters=Filters.group) SET_TITLE_HANDLER = DisableAbleCommandHandler("settitle", set_title, pass_args=True) ADMINLIST_HANDLER = DisableAbleCommandHandler("adminlist", adminlist, filters=Filters.group) dispatcher.add_handler(PIN_HANDLER) dispatcher.add_handler(UNPIN_HANDLER) dispatcher.add_handler(PERMANENT_PIN_SET_HANDLER) dispatcher.add_handler(PERMANENT_PIN_HANDLER) dispatcher.add_handler(INVITE_HANDLER) dispatcher.add_handler(PROMOTE_HANDLER) dispatcher.add_handler(DEMOTE_HANDLER) dispatcher.add_handler(ADMINLIST_HANDLER) dispatcher.add_handler(SET_TITLE_HANDLER) dispatcher.add_handler(CHAT_PIC_HANDLER) dispatcher.add_handler(DEL_CHAT_PIC_HANDLER) dispatcher.add_handler(SETCHAT_TITLE_HANDLER) dispatcher.add_handler(SETSTICKET_HANDLER) dispatcher.add_handler(SETDESC_HANDLER)
else: update.effective_message.reply_text( "Hello " + f"{mention_html(msg.from_user.id, msg.from_user.first_name)}" + ", Please reply to sticker message to get id sticker", parse_mode=ParseMode.HTML, ) __mod_name__ = "Stickers" __help__ = """ • /stickers: Find stickers for given term on combot sticker catalogue. • /stickerid: reply to a sticker to get its ID. • /getsticker: reply to a sticker to get the raw PNG image. • /kang: reply to a sticker or image to add it to your pack. """ KANG_HANDLER = DisableAbleCommandHandler("kang", kang, pass_args=True, admin_ok=True) STICKERID_HANDLER = DisableAbleCommandHandler("stickerid", stickerid) GETSTICKER_HANDLER = DisableAbleCommandHandler("getsticker", getsticker) STICKERS_HANDLER = DisableAbleCommandHandler("stickers", cb_sticker) dispatcher.add_handler(KANG_HANDLER) dispatcher.add_handler(STICKERID_HANDLER) dispatcher.add_handler(GETSTICKER_HANDLER) dispatcher.add_handler(STICKERS_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__ = "⚜ LOCKING ⚜" LOCKTYPES_HANDLER = DisableAbleCommandHandler("locktypes", locktypes) # , filters=Filters.group) LOCK_HANDLER = CommandHandler("lock", lock, pass_args=True) UNLOCK_HANDLER = CommandHandler("unlock", unlock, pass_args=True) # , filters=Filters.group) # , filters=Filters.group) LOCKED_HANDLER = CommandHandler("locks", list_locks) 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)
× /rmallfilter: Stop all chat filters at once. *Note*: Filters also support markdown formatters like: {first}, {last} etc.. and buttons. Check `/markdownhelp` to know more! """ __mod_name__ = "Filters" FILTER_HANDLER = CommandHandler("filter", filters) STOP_HANDLER = CommandHandler("stop", stop_filter) # Don't Use async for this RMALLFILTER_HANDLER = CommandHandler("rmallfilter", rmall_filters, filters=Filters.chat_type.groups, run_async=True) LIST_HANDLER = DisableAbleCommandHandler("filters", list_handlers, admin_ok=True, run_async=True) CUST_FILTER_HANDLER = MessageHandler( CustomFilters.has_text & ~Filters.update.edited_message, reply_filter, run_async=True, ) 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)
def main(): # test_handler = CommandHandler("test", test) start_handler = CommandHandler("start", start, pass_args=True) help_handler = CommandHandler("help", get_help) help_callback_handler = CallbackQueryHandler(help_button, pattern=r"help_") start_callback_handler = CallbackQueryHandler(send_start, pattern=r"bot_start") dispatcher.add_handler(start_callback_handler) startstop_callback_handler = CallbackQueryHandler(start_stop, pattern=r"close_menu") dispatcher.add_handler(startstop_callback_handler) settings_handler = CommandHandler("settings", get_settings) settings_callback_handler = CallbackQueryHandler(settings_button, pattern=r"stngs_") migrate_handler = MessageHandler(Filters.status_update.migrate, migrate_chats) is_chat_allowed_handler = MessageHandler(Filters.group, is_chat_allowed) # 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(help_staff_handler) dispatcher.add_handler(settings_callback_handler) dispatcher.add_handler(migrate_handler) dispatcher.add_handler(is_chat_allowed_handler) dispatcher.add_error_handler(error_handler) 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) client.run_until_disconnected() else: LOGGER.info("Using long polling.") updater.start_polling(timeout=15, read_latency=4) updater.bot.send_message(chat_id=MESSAGE_DUMP, text="Elizabeth Started...") client.run_until_disconnected() updater.idle()
spamwtc = spamwtc.get_ban(int(user.id)) if spamwtc: text += "\n<b>Spamwatch Banned :</b> True" text += f"\n<b>Reason :</b> <pre>{spamwtc.reason}</pre>" else: text += "\n<b>Spamwatch Banned :</b> False" except: pass # don't crash if api is down somehow... text += f"\n\n<b>• {dispatcher.bot.first_name} Status</b>" for mod in USER_BOOK: if mod.__mod_name__ == "Users": continue try: mod_book = mod.__user_book__(user.id) except TypeError: mod_book = mod.__user_book__(user.id, chat.id) if mod_book: text += "\n" + mod_book message.reply_text(text, parse_mode=ParseMode.HTML, disable_web_page_preview=True) BOOK_HANDLER = DisableAbleCommandHandler(("scan"), book, pass_args=True) dispatcher.add_handler(BOOK_HANDLER) __handler__ = [BOOK_HANDLER]