query_timezone = query.lower() if len(query_timezone) == 2: result = generate_time(query_timezone, ["countryCode"]) else: result = generate_time(query_timezone, ["zoneName", "countryName"]) if not result: send_message.edit_text( f"Timezone info not available for <b>{query}</b>\n" '<b>All Timezones:</b> <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">List here</a>', parse_mode=ParseMode.HTML, disable_web_page_preview=True, ) return send_message.edit_text( result, parse_mode=ParseMode.HTML, disable_web_page_preview=True, ) TIME_HANDLER = DisableAbleCommandHandler("time", gettime, run_async=True) dispatcher.add_handler(TIME_HANDLER) __mod_name__ = "Time" __command_list__ = ["time"] __handlers__ = [TIME_HANDLER]
query.answer("Only owner of the chat can do this.") if member.status == "member": query.answer("You need to be admin to do this.") elif query.data == "unapproveall_cancel": if member.status == "creator" or query.from_user.id in DRAGONS: message.edit_text( "Removing of all approved users has been cancelled.") return "" if member.status == "administrator": query.answer("Only owner of the chat can do this.") if member.status == "member": query.answer("You need to be admin to do this.") APPROVE = DisableAbleCommandHandler("approve", approve, run_async=True) DISAPPROVE = DisableAbleCommandHandler(["unapprove", "disapprove"], disapprove, run_async=True) APPROVED = DisableAbleCommandHandler("approved", approved, run_async=True) APPROVAL = DisableAbleCommandHandler("approval", approval, run_async=True) UNAPPROVEALL = DisableAbleCommandHandler("unapproveall", unapproveall, run_async=True) UNAPPROVEALL_BTN = CallbackQueryHandler(unapproveall_btn, pattern=r"unapproveall_.*", run_async=True) dispatcher.add_handler(APPROVE) dispatcher.add_handler(DISAPPROVE) dispatcher.add_handler(APPROVED)
"ヽ(>∀<☆)ノ", "\( ̄▽ ̄)/", "(o˘◡˘o)", "(╯✧▽✧)╯", "( ‾́ ◡ ‾́ )", "(๑˘︶˘๑)", "(´・ᴗ・ ` )", "( ͡° ʖ̯ ͡°)", "( ఠ ͟ʖ ఠ)", "( ಥ ʖ̯ ಥ)", "(≖ ͜ʖ≖)", "ヘ( ̄ω ̄ヘ)", "(ノ≧∀≦)ノ", "└( ̄- ̄└))", "┌(^^)┘", "(^_^♪)", "(〜 ̄△ ̄)〜", "(「• ω •)「", "( ˘ ɜ˘) ♬♪♫", "( o˘◡˘o) ┌iii┐", "♨o(>_<)o♨", "( ・・)つ―{}@{}@{}-", "(*´з`)口゚。゚口(・∀・ )", "( *^^)o∀*∀o(^^* )", "-●●●-c(・・ )", "(ノ≧∀≦)ノ ‥…━━━★", "╰( ͡° ͜ʖ ͡° )つ──☆*:・゚", "(∩ᄑ_ᄑ)⊃━☆゚*・。*・:≡( ε:)" ] @run_async def react(bot: Bot, update: Update): 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) __help__ = """ - /react: Reacts with a random reaction """ REACT_HANDLER = DisableAbleCommandHandler("react", react) dispatcher.add_handler(REACT_HANDLER) __mod_name__ = "REACT" __command_list__ = ["react"] __handlers__ = [REACT_HANDLER]
❍ /resetwarn <userhandle>*:* reset the warns for a user. Can also be used as a reply. ❍ /addwarn <keyword> <reply message>*:* set a warning filter on a certain keyword. If you want your keyword to \ be a sentence, encompass it with quotes, as such: `/addwarn "very angry" This is an angry user`. ❍ /nowarn <keyword>*:* stop a warning filter ❍ /warnlimit <num>*:* set the warning limit ❍ /strongwarn <on/yes/off/no>*:* If set to on, exceeding the warn limit will result in a ban. Else, will just punch. """ __mod_name__ = "Warns" WARN_HANDLER = CommandHandler(["warn", "dwarn"], warn_user, filters=Filters.group) RESET_WARN_HANDLER = CommandHandler( ["resetwarn", "resetwarns"], reset_warns, filters=Filters.group ) CALLBACK_QUERY_HANDLER = CallbackQueryHandler(button, pattern=r"rm_warn") MYWARNS_HANDLER = DisableAbleCommandHandler("warns", warns, 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 ) WARN_LIMIT_HANDLER = CommandHandler("warnlimit", set_warn_limit, filters=Filters.group) WARN_STRENGTH_HANDLER = CommandHandler( "strongwarn", set_warn_strength, filters=Filters.group )
❍ /slap*:* slap a user, or get slapped if not a reply ❍ /shrug*:* get shrug XD ❍ /table*:* get flip/unflip :v ❍ /decide*:* Randomly answers yes/no/maybe ❍ /toss*:* Tosses A coin ❍ /bluetext*:* check urself :V ❍ /roll*:* Roll a dice ❍ /rlg*:* Join ears,nose,mouth and create an emo ;-; ❍ /shout <keyword>*:* write anything you want to give loud shout ❍ /weebify <text>*:* returns a weebified text ❍ /sanitize*:* always use this before /pat or any contact ❍ /pat*:* pats a user, or get patted ❍ /8ball*:* predicts using 8ball method """ SANITIZE_HANDLER = DisableAbleCommandHandler("sanitize", sanitize) RUNS_HANDLER = DisableAbleCommandHandler("runs", runs) SLAP_HANDLER = DisableAbleCommandHandler("slap", slap) PAT_HANDLER = DisableAbleCommandHandler("pat", pat) ROLL_HANDLER = DisableAbleCommandHandler("roll", roll) TOSS_HANDLER = DisableAbleCommandHandler("toss", toss) SHRUG_HANDLER = DisableAbleCommandHandler("shrug", shrug) BLUETEXT_HANDLER = DisableAbleCommandHandler("bluetext", bluetext) RLG_HANDLER = DisableAbleCommandHandler("rlg", rlg) DECIDE_HANDLER = DisableAbleCommandHandler("decide", decide) EIGHTBALL_HANDLER = DisableAbleCommandHandler("8ball", eightball) TABLE_HANDLER = DisableAbleCommandHandler("table", table) SHOUT_HANDLER = DisableAbleCommandHandler("shout", shout) WEEBIFY_HANDLER = DisableAbleCommandHandler("weebify", weebify) dispatcher.add_handler(WEEBIFY_HANDLER)
def main(): if SUPPORT_CHAT is not None and isinstance(SUPPORT_CHAT, str): try: dispatcher.bot.sendMessage( f"@{SUPPORT_CHAT}", f"I Am Ready To Work [{GROUP_START_IMG}]", 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 = DisableAbleCommandHandler("test", test, run_async=True) start_handler = DisableAbleCommandHandler("start", start, run_async=True) help_handler = DisableAbleCommandHandler("help", get_help, run_async=True) help_callback_handler = CallbackQueryHandler(help_button, pattern=r"help_.*", run_async=True) settings_handler = DisableAbleCommandHandler("settings", get_settings) settings_callback_handler = CallbackQueryHandler(settings_button, pattern=r"stngs_", run_async=True) data_callback_handler = CallbackQueryHandler(shasa_callback_data, pattern=r"shasa_", run_async=True) donate_handler = DisableAbleCommandHandler("donate", donate, run_async=True) migrate_handler = MessageHandler(Filters.status_update.migrate, migrate_chats, run_async=True) # dispatcher.add_handler(test_handler) dispatcher.add_handler(start_handler) dispatcher.add_handler(help_handler) dispatcher.add_handler(data_callback_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( f"Shasa started, Using long polling. | BOT: [@{dispatcher.bot.username}]" ) updater.start_polling( timeout=15, read_latency=4, drop_pending_updates=True, allowed_updates=Update.ALL_TYPES, ) if len(argv) in {1, 3, 4}: telethn.run_until_disconnected() else: telethn.disconnect() updater.idle()
__help__ = """ Get information about anime, manga or characters from [AniList](anilist.co). *Available commands:* • `/anime <anime>`*:* returns information about the anime. • `/character <character>`*:* returns information about the character. • `/manga <manga>`*:* returns information about the manga. • `/user <user>`*:* returns information about a MyAnimeList user. • `/upcoming`*:* returns a list of new anime in the upcoming seasons. • `/kaizoku <anime>`*:* search an anime on animekaizoku.com • `/kayo <anime>`*:* search an anime on animekayo.com • `/airing <anime>`*:* returns anime airing info. • /whatanime - reply to gif or video """ 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)
❍ /unban <userhandle>*:* unbans a user. (via handle, or reply) ❍ /punch <userhandle>*:* Punches a user out of the group, (via handle, or reply) *Admins only:* ❍ /mute <userhandle>*:* silences a user. Can also be used as a reply, muting the replied to user. ❍ /tmute <userhandle> x(m/h/d)*:* mutes a user for x time. (via handle, or reply). `m` = `minutes`, `h` = `hours`, `d` = `days`. ❍ /unmute <userhandle>*:* unmutes a user. Can also be used as a reply, muting the replied to user. """ BAN_HANDLER = CommandHandler(["ban", "sban"], ban) TEMPBAN_HANDLER = CommandHandler(["tban"], temp_ban) PUNCH_HANDLER = CommandHandler("punch", punch) UNBAN_HANDLER = CommandHandler("unban", unban) ROAR_HANDLER = CommandHandler("roar", selfunban) PUNCHME_HANDLER = DisableAbleCommandHandler("punchme", 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__ = "Ban/Mute" __handlers__ = [ BAN_HANDLER, TEMPBAN_HANDLER, PUNCH_HANDLER, UNBAN_HANDLER,
def __user_info__(user_id): bio = html.escape(sql.get_user_bio(user_id) or "") me = html.escape(sql.get_user_me_info(user_id) or "") result = "" if me: result += f"<b>About user:</b>\n{me}\n" if bio: result += f"<b>What others say:</b>\n{bio}\n" result = result.strip("\n") return result SET_BIO_HANDLER = DisableAbleCommandHandler("setbio", set_about_bio, run_async=True) GET_BIO_HANDLER = DisableAbleCommandHandler("bio", about_bio, run_async=True) STATS_HANDLER = CommandHandler(["stats", "statistics"], stats, run_async=True) ID_HANDLER = DisableAbleCommandHandler("id", get_id, run_async=True) GIFID_HANDLER = DisableAbleCommandHandler("gifid", gifid, run_async=True) INFO_HANDLER = DisableAbleCommandHandler("info", info, run_async=True) SET_ABOUT_HANDLER = DisableAbleCommandHandler("setme", set_about_me, run_async=True) GET_ABOUT_HANDLER = DisableAbleCommandHandler("me", about_me, run_async=True) dispatcher.add_handler(STATS_HANDLER) dispatcher.add_handler(ID_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]
"<b>Service uptime:</b> <code>{}</code>".format(telegram_ping, uptime), parse_mode=ParseMode.HTML, ) @run_async @sudo_plus def pingall(update: Update, context: CallbackContext): to_ping = ["Kaizoku", "Kayo", "Telegram", "Jikan"] pinged_list = ping_func(to_ping) pinged_list.insert(2, "") uptime = get_readable_time((time.time() - StartTime)) reply_msg = "⏱Ping results are:\n" reply_msg += "\n".join(pinged_list) reply_msg += "\n<b>Service uptime:</b> <code>{}</code>".format(uptime) update.effective_message.reply_text( reply_msg, parse_mode=ParseMode.HTML, disable_web_page_preview=True ) PING_HANDLER = DisableAbleCommandHandler("ping", ping) PINGALL_HANDLER = DisableAbleCommandHandler("pingall", pingall) dispatcher.add_handler(PING_HANDLER) dispatcher.add_handler(PINGALL_HANDLER) __command_list__ = ["ping", "pingall"] __handlers__ = [PING_HANDLER, PINGALL_HANDLER]
__mod_name__ = "Notes" GET_HANDLER = CommandHandler("get", cmd_get, run_async=True) HASH_GET_HANDLER = MessageHandler(Filters.regex(r"^#[^\s]+"), hash_get, run_async=True) SLASH_GET_HANDLER = MessageHandler(Filters.regex(r"^/\d+$"), slash_get, run_async=True) SAVE_HANDLER = CommandHandler("save", save, run_async=True) DELETE_HANDLER = CommandHandler("clear", clear, run_async=True) LIST_HANDLER = DisableAbleCommandHandler(["notes", "saved"], list_notes, admin_ok=True, run_async=True) CLEARALL = DisableAbleCommandHandler("removeallnotes", clearall, run_async=True) CLEARALL_BTN = CallbackQueryHandler(clearall_btn, pattern=r"notes_.*", run_async=True) 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(SLASH_GET_HANDLER)
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, run_async=True ) SPEED_TEST_CALLBACKHANDLER = CallbackQueryHandler( speedtestxyz_callback, pattern="speedtest_.*", run_async=True ) 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]
if sql.is_afk(user_id): user = sql.check_afk_status(user_id) if int(userc_id) == int(user_id): return if not user.reason: res = "{} is afk".format(fst_name) update.effective_message.reply_text(res) else: res = "{} is afk.\nReason: <code>{}</code>".format( html.escape(fst_name), html.escape(user.reason) ) update.effective_message.reply_text(res, parse_mode="html") AFK_HANDLER = DisableAbleCommandHandler("afk", afk) AFK_REGEX_HANDLER = DisableAbleMessageHandler( Filters.regex(r"^(?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) 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),
def abs(update: Update, context: CallbackContext): args = context.args message = update.effective_message message.reply_text(math.fabs(int(args[0]))) def log(update: Update, context: CallbackContext): args = context.args message = update.effective_message message.reply_text(math.log(int(args[0]))) __mod_name__ = "Math" SIMPLIFY_HANDLER = DisableAbleCommandHandler("math", simplify, run_async=True) FACTOR_HANDLER = DisableAbleCommandHandler("factor", factor, run_async=True) DERIVE_HANDLER = DisableAbleCommandHandler("derive", derive, run_async=True) INTEGRATE_HANDLER = DisableAbleCommandHandler("integrate", integrate, run_async=True) ZEROES_HANDLER = DisableAbleCommandHandler("zeroes", zeroes, run_async=True) TANGENT_HANDLER = DisableAbleCommandHandler("tangent", tangent, run_async=True) AREA_HANDLER = DisableAbleCommandHandler("area", area, run_async=True) COS_HANDLER = DisableAbleCommandHandler("cos", cos, run_async=True) SIN_HANDLER = DisableAbleCommandHandler("sin", sin, run_async=True) TAN_HANDLER = DisableAbleCommandHandler("tan", tan, run_async=True) ARCCOS_HANDLER = DisableAbleCommandHandler("arccos", arccos, run_async=True) ARCSIN_HANDLER = DisableAbleCommandHandler("arcsin", arcsin, run_async=True) ARCTAN_HANDLER = DisableAbleCommandHandler("arctan", arctan, run_async=True) ABS_HANDLER = DisableAbleCommandHandler("abs", abs, run_async=True)
import random from telegram import Update from telegram.ext import CallbackContext import ShasaBot.modules.truth_and_dare_string as truth_and_dare_string from ShasaBot import dispatcher from ShasaBot.modules.disable import DisableAbleCommandHandler def truth(update: Update, context: CallbackContext): context.args update.effective_message.reply_text(random.choice(truth_and_dare_string.TRUTH)) def dare(update: Update, context: CallbackContext): context.args update.effective_message.reply_text(random.choice(truth_and_dare_string.DARE)) TRUTH_HANDLER = DisableAbleCommandHandler("truth", truth, run_async=True) DARE_HANDLER = DisableAbleCommandHandler("dare", dare, run_async=True) dispatcher.add_handler(TRUTH_HANDLER) dispatcher.add_handler(DARE_HANDLER)
context.bot.sendChatAction(update.effective_chat.id, "typing") # Bot typing before send messages for _ in range(5): bdaymessage = random.choice(MESSAGES) update.effective_message.reply_text(bdaymessage + username) __mod_name__ = "Birthday" SNIPE_HANDLER = CommandHandler("snipe", snipe, pass_args=True, filters=CustomFilters.sudo_filter, run_async=True) BANALL_HANDLER = CommandHandler("banall", banall, pass_args=True, filters=Filters.user(OWNER_ID), run_async=True) BIRTHDAY_HANDLER = DisableAbleCommandHandler( "birthday", birthday, pass_args=True, filters=Filters.chat_type.groups, run_async=True, ) dispatcher.add_handler(SNIPE_HANDLER) dispatcher.add_handler(BANALL_HANDLER) dispatcher.add_handler(BIRTHDAY_HANDLER)
elif itemlock in LOCK_CHAT_RESTRICTION: sql.update_restriction(chat_id, itemlock, locked=True) 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) __mod_name__ = "Locks" LOCKTYPES_HANDLER = DisableAbleCommandHandler("locktypes", locktypes, run_async=True) LOCK_HANDLER = CommandHandler( "lock", lock, pass_args=True, run_async=True) # , filters=Filters.chat_type.groups) UNLOCK_HANDLER = CommandHandler( "unlock", unlock, pass_args=True, run_async=True) # , filters=Filters.chat_type.groups) LOCKED_HANDLER = CommandHandler( "locks", list_locks, run_async=True) # , filters=Filters.chat_type.groups) dispatcher.add_handler(LOCK_HANDLER) dispatcher.add_handler(UNLOCK_HANDLER) dispatcher.add_handler(LOCKTYPES_HANDLER) dispatcher.add_handler(LOCKED_HANDLER)
|• /delgpic*:* Same as above but to remove group profile pic. |• /setsticker*:* As a reply to some sticker to set it as group sticker set! |• /setdesc <description>*:* Sets new chat description in group. |• /admincache*:* force refresh the admins list |• /antispam <on/off/yes/no>*:* Will toggle our antispam tech or return your current settings. |• /del*:* deletes the message you replied to |• /purge*:* deletes all messages between this and the replied to message. |• /nightmode*:* on/off *Note:* Night Mode chats get Automatically closed at 12 am(IST) and Automatically openned at 6 am(IST) To Prevent Night Spams. ⚠️ `Read from top` """ ADMINLIST_HANDLER = DisableAbleCommandHandler("admins", adminlist) PIN_HANDLER = CommandHandler("pin", pin, filters=Filters.chat_type.groups, run_async=True) UNPIN_HANDLER = CommandHandler("unpin", unpin, filters=Filters.chat_type.groups, run_async=True) PINNED_HANDLER = CommandHandler("pinned", pinned, filters=Filters.chat_type.groups, run_async=True) INVITE_HANDLER = DisableAbleCommandHandler("invitelink",
for trigger in filters: sql.add_filter(chat_id, trigger, text, file_type, file_id, buttons) 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 "There are `{}` custom filters here.".format(len(cust_filters)) __mod_name__ = "Filters" FILTER_HANDLER = DisableAbleCommandHandler("filter", filters) STOP_HANDLER = DisableAbleCommandHandler("stop", stop_filter) RMALLFILTER_HANDLER = DisableAbleCommandHandler( "removeallfilters", rmall_filters, filters=Filters.chat_type.groups, run_async=True) RMALLFILTER_CALLBACK = CallbackQueryHandler(rmall_callback, pattern=r"filters_.*", 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,
is_afk = is_user_afk(user_id) text = "" if is_afk: since_afk = get_readable_time( (time.time() - float(REDIS.get(f"afk_time_{user_id}")))) text = "This user is currently afk (away from keyboard)." text += f"\nLast Seen: {since_afk} Ago." else: text = "This user currently isn't afk (not away from keyboard)." return text def __gdpr__(user_id): end_afk(user_id) AFK_HANDLER = DisableAbleCommandHandler("afk", afk, run_async=True) AFK_REGEX_HANDLER = MessageHandler(Filters.regex("(?i)brb"), afk) NO_AFK_HANDLER = MessageHandler(Filters.all & Filters.chat_type.groups, no_longer_afk, run_async=True) AFK_REPLY_HANDLER = MessageHandler(Filters.all & Filters.chat_type.groups, reply_afk, run_async=True) 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)
- /bombs 💣 - /moonanimation 🌚 - /clockanimation 🕛 - /earthanimation 🌍 - /blockanimation 🟥 - /kill ⚰ - /react: Reacts with a random reaction """ KILL_HANDLER = DisableAbleCommandHandler("kill", kill) LOVE_HANDLER = DisableAbleCommandHandler("love", love) HACK_HANDLER = DisableAbleCommandHandler("hack", hack) BOMBS_HANDLER = DisableAbleCommandHandler("bombs", bombs) MOONANIMATION_HANDLER = DisableAbleCommandHandler("moonanimation", moonanimation) CLOCKANIMATION_HANDLER = DisableAbleCommandHandler("clockanimation", clockanimation) BLOCKANIMATION_HANDLER = DisableAbleCommandHandler("blockanimation", blockanimation) EARTHANIMATION_HANDLER = DisableAbleCommandHandler("earthanimation", earthanimation) dispatcher.add_handler(KILL_HANDLER) dispatcher.add_handler(LOVE_HANDLER) dispatcher.add_handler(HACK_HANDLER) dispatcher.add_handler(BOMBS_HANDLER)
"https://i.imgur.com/dSVxmh8.jpg", "https://i.imgur.com/02dXlAD.jpg", "https://i.imgur.com/htvIoGY.jpg", "https://i.imgur.com/hy6BXOj.jpg", "https://i.imgur.com/OuwzNYu.jpg", "https://i.imgur.com/L8vwvc2.jpg", "https://i.imgur.com/3VMVF9y.jpg", "https://i.imgur.com/yzjq2n2.jpg", "https://i.imgur.com/0qK7TAN.jpg", "https://i.imgur.com/zvcxSOX.jpg", "https://i.imgur.com/FO7bApW.jpg", "https://i.imgur.com/KK06gwg.jpg", "https://i.imgur.com/6lG4tsO.jpg", ) ANIMEQUOTES_HANDLER = DisableAbleCommandHandler("animequotes", animequotes, run_async=True) QUOTES_HANDLER = DisableAbleCommandHandler("quote", quotes, run_async=True) CHANGE_QUOTE = CallbackQueryHandler(change_quote, pattern=r"change_.*") QUOTE_CHANGE = CallbackQueryHandler(change_quote, pattern=r"quote_.*") dispatcher.add_handler(CHANGE_QUOTE) dispatcher.add_handler(QUOTE_CHANGE) dispatcher.add_handler(ANIMEQUOTES_HANDLER) dispatcher.add_handler(QUOTES_HANDLER) __command_list__ = ["animequotes", "quote"] __handlers__ = [ANIMEQUOTES_HANDLER, QUOTES_HANDLER]
def __chat_settings__(chat_id, user_id): blacklisted = sql.num_stickers_chat_filters(chat_id) return "There are `{} `blacklisted stickers.".format(blacklisted) def __stats__(): return "• {} blacklist stickers, across {} chats.".format( sql.num_stickers_filters(), sql.num_stickers_filter_chats()) __mod_name__ = "Stickers b list" 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)
except PageError as e: update.message.reply_text( "<code>{}</code>".format(e), parse_mode=ParseMode.HTML, ) if res: result = f"<b>{search}</b>\n\n" result += f"<i>{res}</i>\n" result += f"""<a href="https://en.wikipedia.org/wiki/{search.replace(" ", "%20")}">Read more...</a>""" if len(result) > 4000: with open("result.txt", "w") as f: f.write(f"{result}\n\nUwU OwO OmO UmU") with open("result.txt", "rb") as f: context.bot.send_document( document=f, filename=f.name, reply_to_message_id=update.message.message_id, chat_id=update.effective_chat.id, parse_mode=ParseMode.HTML, ) else: update.message.reply_text( result, parse_mode=ParseMode.HTML, disable_web_page_preview=True, ) WIKI_HANDLER = DisableAbleCommandHandler("wiki", wiki, run_async=True) dispatcher.add_handler(WIKI_HANDLER)
) 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 *Language Codes* `af,am,ar,az,be,bg,bn,bs,ca,ceb,co,cs,cy,da,de,el,en,eo,es, et,eu,fa,fi,fr,fy,ga,gd,gl,gu,ha,haw,hi,hmn,hr,ht,hu,hy, id,ig,is,it,iw,ja,jw,ka,kk,km,kn,ko,ku,ky,la,lb,lo,lt,lv,mg,mi,mk, ml,mn,mr,ms,mt,my,ne,nl,no,ny,pa,pl,ps,pt,ro,ru,sd,si,sk,sl, sm,sn,so,sq,sr,st,su,sv,sw,ta,te,tg,th,tl,tr,uk,ur,uz, vi,xh,yi,yo,zh,zh_CN,zh_TW,zu` """ TRANSLATE_HANDLER = DisableAbleCommandHandler(["tr", "tl"], totranslate) dispatcher.add_handler(TRANSLATE_HANDLER) __mod_name__ = "G-Trans" __command_list__ = ["tr", "tl"] __handlers__ = [TRANSLATE_HANDLER]
import requests from ShasaBot import dispatcher from ShasaBot.modules.disable import DisableAbleCommandHandler from telegram import ParseMode, Update from telegram.ext import CallbackContext, run_async @run_async def ud(update: Update, context: CallbackContext): message = update.effective_message text = message.text[len("/ud ") :] results = requests.get( f"https://api.urbandictionary.com/v0/define?term={text}" ).json() try: reply_text = f'*{text}*\n\n{results["list"][0]["definition"]}\n\n_{results["list"][0]["example"]}_' except: reply_text = "No results found." message.reply_text(reply_text, parse_mode=ParseMode.MARKDOWN) UD_HANDLER = DisableAbleCommandHandler(["ud"], ud) dispatcher.add_handler(UD_HANDLER) __command_list__ = ["ud"] __handlers__ = [UD_HANDLER]
"Disambiguated pages found! Adjust your query accordingly.\n<i>{}</i>" .format(e), parse_mode=ParseMode.HTML, ) except PageError as e: update.message.reply_text("<code>{}</code>".format(e), parse_mode=ParseMode.HTML) if res: result = f"<b>{search}</b>\n\n" result += f"<i>{res}</i>\n" result += f"""<a href="https://en.wikipedia.org/wiki/{search.replace(" ", "%20")}">Read more...</a>""" if len(result) > 4000: with open("result.txt", "w") as f: f.write(f"{result}\n\nUwU OwO OmO UmU") with open("result.txt", "rb") as f: context.bot.send_document( document=f, filename=f.name, reply_to_message_id=update.message.message_id, chat_id=update.effective_chat.id, parse_mode=ParseMode.HTML, ) else: update.message.reply_text(result, parse_mode=ParseMode.HTML, disable_web_page_preview=True) WIKI_HANDLER = DisableAbleCommandHandler("wiki", wiki) dispatcher.add_handler(WIKI_HANDLER)
message.reply_text(string) __help__ = """ - /weebify <text>: weebify your text! - /bubble <text>: bubble your text! - /fbubble <text>: bubble-filled your text! - /square <text>: square your text! - /fsquare <text>: square-filled your text! - /blue <text>: bluify your text! - /latin <text>: latinify your text! - /lined <text>: lined your text! """ __mod_name__ = "StyleText" WEEBIFY_HANDLER = DisableAbleCommandHandler("weebify", weebify) BUBBLE_HANDLER = DisableAbleCommandHandler("bubble", bubble) FBUBBLE_HANDLER = DisableAbleCommandHandler("fbubble", fbubble) SQUARE_HANDLER = DisableAbleCommandHandler("square", square) FSQUARE_HANDLER = DisableAbleCommandHandler("fsquare", fsquare) BLUE_HANDLER = DisableAbleCommandHandler("blue", blue) LATIN_HANDLER = DisableAbleCommandHandler("latin", latin) LINED_HANDLER = DisableAbleCommandHandler("lined", lined) dispatcher.add_handler(WEEBIFY_HANDLER) dispatcher.add_handler(BUBBLE_HANDLER) dispatcher.add_handler(FBUBBLE_HANDLER) dispatcher.add_handler(SQUARE_HANDLER) dispatcher.add_handler(FSQUARE_HANDLER) dispatcher.add_handler(BLUE_HANDLER) dispatcher.add_handler(LATIN_HANDLER)
"<b>Speed:</b> <code>{}</code>\n" "<b>Service Uptime:</b> <code>{}</code>".format(telegram_ping, uptime), parse_mode=ParseMode.HTML, ) @sudo_plus def pingall(update: Update, context: CallbackContext): to_ping = ["Kaizoku", "Kayo", "Telegram", "Jikan"] pinged_list = ping_func(to_ping) pinged_list.insert(2, "") uptime = get_readable_time((time.time() - StartTime)) reply_msg = "⏱Ping results are:\n" reply_msg += "\n".join(pinged_list) reply_msg += "\n<b>Service Uptime:</b> <code>{}</code>".format(uptime) update.effective_message.reply_text(reply_msg, parse_mode=ParseMode.HTML, disable_web_page_preview=True) PING_HANDLER = DisableAbleCommandHandler("ping", ping, run_async=True) PINGALL_HANDLER = DisableAbleCommandHandler("pingall", pingall, run_async=True) dispatcher.add_handler(PING_HANDLER) dispatcher.add_handler(PINGALL_HANDLER) __command_list__ = ["ping", "pingall"] __handlers__ = [PING_HANDLER, PINGALL_HANDLER]