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 #add __help__ = """ - /bl <reason>: blacklist user. - /unbl unblacklist user. - /blusers list of blacklist user NOTE: THIS IS EXTRA Module FOR NOW ON BETA MODE :) """ BL_HANDLER = CommandHandler("ignore", bl_user, pass_args=True) UNBL_HANDLER = CommandHandler("notice", unbl_user, pass_args=True) BLUSERS_HANDLER = CommandHandler("ignoredlist", bl_users) dispatcher.add_handler(BL_HANDLER) dispatcher.add_handler(UNBL_HANDLER) dispatcher.add_handler(BLUSERS_HANDLER) __mod_name__ = "Blacklist 🚷" __handlers__ = [BL_HANDLER, UNBL_HANDLER, BLUSERS_HANDLER]
import json from typing import Optional, List import time import urllib from urllib.request import urlopen, urlretrieve from urllib.parse import quote_plus, urlencode import requests from telegram import Message, Chat, Update, Bot, MessageEntity from telegram import ParseMode from telegram.ext import CommandHandler, run_async, Filters from Yui_Gbot import dispatcher from Yui_Gbot.__main__ import STATS, USER_INFO from Yui_Gbot.modules.disable import DisableAbleCommandHandler import wikipedia def wiki(bot: Bot, update: Update, args): reply = " ".join(args) summary = '{} <a href="{}">more</a>' update.message.reply_text( summary.format(wikipedia.summary(reply, sentences=3), wikipedia.page(reply).url)) __help__ = """ - /wiki text: Returns search from wikipedia for the input text """ __mod_name__ = "WIKIPEDIA" WIKI_HANDLER = DisableAbleCommandHandler("wiki", wiki, pass_args=True) dispatcher.add_handler(WIKI_HANDLER)
*Username:* `{usr['login']}` *Account ID:* `{usr['id']}` *Account type:* `{usr['type']}` *Location:* `{usr['location']}` *Bio:* `{usr['bio']}` *Followers:* `{usr['followers']}` *Following:* `{usr['following']}` *Hireable:* `{usr['hireable']}` *Public Repos:* `{usr['public_repos']}` *Public Gists:* `{usr['public_gists']}` *Email:* `{usr['email']}` *Company:* `{usr['company']}` *Website:* `{usr['blog']}` *Last updated:* `{usr['updated_at']}` *Account created at:* `{usr['created_at']}` """ else: reply_text = "User not found. Make sure you entered valid username!" message.reply_text(reply_text, parse_mode=ParseMode.MARKDOWN) __help__ = """ - /git:{GitHub username} Returns info about a GitHub user or organization. """ __mod_name__ = "GITHUB" github_handle = DisableAbleCommandHandler("git", github) dispatcher.add_handler(github_handle)
deceased = sdict['deaths'] recovered = sdict['recovered'] state = sdict['state'] break if state: bot.send_message( message.chat.id, '`COVID-19 Tracker`\n*Number of confirmed cases in %s:* %s\n*Deceased:* %s\n*Recovered:* %s\n\n_Source:_ covid19india.org' % (state, confirmed, deceased, recovered), parse_mode = ParseMode.MARKDOWN, disable_web_page_preview = True ) else: bot.send_message( message.chat.id, 'You need to specify a valid Indian state!', parse_mode = ParseMode.MARKDOWN, disable_web_page_preview = True ) __help__ = """ - /covindia <state>: Get real time COVID-19 stats for the input Indian state """ __mod_name__ = 'COVID-19 VIRUS' COV_INDIA_HANDLER = CommandHandler('covindia', covindia) dispatcher.add_handler(COV_INDIA_HANDLER)
f"<b>Admin:</b> {mention_html(user.id, user.first_name)}\n" f"Message deleted.") else: update.effective_message.reply_text("Whadya want to delete?") return "" __help__ = """ *Admin only:* - /del: deletes the message you replied to - /purge: deletes all messages between this and the replied to message. - /purge <integer X>: deletes the replied message, and X messages following it if replied to a message. - /purge <integer X>: deletes the number of messages starting from bottom. (Counts manaully deleted messages too) """ DELETE_HANDLER = DisableAbleCommandHandler("del", del_message, filters=Filters.group) PURGE_HANDLER = DisableAbleCommandHandler("purge", purge, filters=Filters.group, pass_args=True) dispatcher.add_handler(DELETE_HANDLER) dispatcher.add_handler(PURGE_HANDLER) __mod_name__ = "PURGE & DEL" __command_list__ = ["del", "purge"] __handlers__ = [DELETE_HANDLER, PURGE_HANDLER]
- /cleanblue <on/off/yes/no> - clean commands after sending - /ignoreblue <word> - prevent auto cleaning of the command - /unignoreblue <word> - remove prevent auto cleaning of the command - /listblue - list currently whitelisted commands Following are Disasters only commands, admins cannot use these: - /gignoreblue <word> - globally ignore bluetext cleaning. - /ungignoreblue <word> - remove said command from global cleaning list """ SET_CLEAN_BLUE_TEXT_HANDLER = CommandHandler("cleanblue", set_blue_text_must_click, pass_args=True) ADD_CLEAN_BLUE_TEXT_HANDLER = CommandHandler("ignoreblue", add_bluetext_ignore, pass_args=True) REMOVE_CLEAN_BLUE_TEXT_HANDLER = CommandHandler("unignoreblue", remove_bluetext_ignore, pass_args=True) ADD_CLEAN_BLUE_TEXT_GLOBAL_HANDLER = CommandHandler("gignoreblue", add_bluetext_ignore_global, pass_args=True) REMOVE_CLEAN_BLUE_TEXT_GLOBAL_HANDLER = CommandHandler("ungignoreblue", remove_bluetext_ignore_global, pass_args=True) LIST_CLEAN_BLUE_TEXT_HANDLER = CommandHandler("listblue", bluetext_ignore_list) 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(ADD_CLEAN_BLUE_TEXT_HANDLER) dispatcher.add_handler(REMOVE_CLEAN_BLUE_TEXT_HANDLER) dispatcher.add_handler(ADD_CLEAN_BLUE_TEXT_GLOBAL_HANDLER) dispatcher.add_handler(REMOVE_CLEAN_BLUE_TEXT_GLOBAL_HANDLER) dispatcher.add_handler(LIST_CLEAN_BLUE_TEXT_HANDLER) dispatcher.add_handler(CLEAN_BLUE_TEXT_HANDLER, BLUE_TEXT_CLEAN_GROUP) __mod_name__ = "BlUETEXT CLEANING" __handlers__ = [SET_CLEAN_BLUE_TEXT_HANDLER, ADD_CLEAN_BLUE_TEXT_HANDLER, REMOVE_CLEAN_BLUE_TEXT_HANDLER, ADD_CLEAN_BLUE_TEXT_GLOBAL_HANDLER, REMOVE_CLEAN_BLUE_TEXT_GLOBAL_HANDLER, LIST_CLEAN_BLUE_TEXT_HANDLER, (CLEAN_BLUE_TEXT_HANDLER, BLUE_TEXT_CLEAN_GROUP)]
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) SET_TITLE_HANDLER = CommandHandler("settitle", set_title, pass_args=True) CHAT_PIC_HANDLER = CommandHandler("setgpic", setchatpic, filters=Filters.group) DEL_CHAT_PIC_HANDLER = CommandHandler("delgpic", rmchatpic, filters=Filters.group) ADMINLIST_HANDLER = DisableAbleCommandHandler("adminlist", adminlist, filters=Filters.group) dispatcher.add_handler(PIN_HANDLER) dispatcher.add_handler(UNPIN_HANDLER) dispatcher.add_handler(INVITE_HANDLER) dispatcher.add_handler(PROMOTE_HANDLER) dispatcher.add_handler(DEMOTE_HANDLER) dispatcher.add_handler(SET_TITLE_HANDLER) dispatcher.add_handler(CHAT_PIC_HANDLER) dispatcher.add_handler(DEL_CHAT_PIC_HANDLER) dispatcher.add_handler(ADMINLIST_HANDLER) __mod_name__ = "ADMIN" __command_list__ = ["adminlist", "admins", "invitelink"] __handlers__ = [ADMINLIST_HANDLER, PIN_HANDLER, UNPIN_HANDLER, INVITE_HANDLER, PROMOTE_HANDLER, DEMOTE_HANDLER, SET_TITLE_HANDLER, CHAT_PIC_HANDLER, DEL_CHAT_PIC_HANDLER]
def main(): test_handler = CommandHandler("test", test) start_handler = CommandHandler("start", start, pass_args=True) start_callback_handler = CallbackQueryHandler(send_start, pattern=r"bot_start") help_handler = CommandHandler("help", get_help) help_callback_handler = CallbackQueryHandler(help_button, pattern=r"help_") IMDB_HANDLER = CommandHandler("imdb", imdb, pass_args=True) IMDB_SEARCHDATA_HANDLER = CallbackQueryHandler(imdb_searchdata) settings_handler = CommandHandler("settings", get_settings) settings_callback_handler = CallbackQueryHandler(settings_button, pattern=r"stngs_") 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(start_callback_handler) dispatcher.add_handler(IMDB_HANDLER) dispatcher.add_handler(IMDB_SEARCHDATA_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("i Am online Master 😎") updater.start_polling(timeout=15, read_latency=4) updater.idle()
if excp.message == "Reply message not found": # Do not reply message.reply_text(f"Muted for {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) message.reply_text("Well damn, I can't mute that user.") return "" __help__ = """ *Admin 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. """ MUTE_HANDLER = CommandHandler("mute", mute, pass_args=True) UNMUTE_HANDLER = CommandHandler("unmute", unmute, pass_args=True) TEMPMUTE_HANDLER = CommandHandler(["tmute", "tempmute"], temp_mute, pass_args=True) dispatcher.add_handler(MUTE_HANDLER) dispatcher.add_handler(UNMUTE_HANDLER) dispatcher.add_handler(TEMPMUTE_HANDLER) __mod_name__ = "MUTES" __handlers__ = [MUTE_HANDLER, UNMUTE_HANDLER, TEMPMUTE_HANDLER]
return "No log channel is set for this group!" __help__ = """ *Admin only:* - /logchannel: get log channel info - /setlog: set the log channel. - /unsetlog: unset the log channel. Setting the log channel is done by: - adding the bot to the desired channel (as an admin!) - sending /setlog in the channel - forwarding the /setlog to the group """ __mod_name__ = "LOG CHANNEL" 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 def gloggable(func): return func
__help__ = "" __mod_name__ = "REMOTE COMMANDS" RBAN_HANDLER = CommandHandler("rban", rban, pass_args=True, filters=CustomFilters.sudo_filter) RUNBAN_HANDLER = CommandHandler("runban", runban, pass_args=True, filters=CustomFilters.sudo_filter) RKICK_HANDLER = CommandHandler("rkick", rkick, pass_args=True, filters=CustomFilters.sudo_filter) RMUTE_HANDLER = CommandHandler("rmute", rmute, pass_args=True, filters=CustomFilters.sudo_filter) RUNMUTE_HANDLER = CommandHandler("runmute", runmute, pass_args=True, filters=CustomFilters.sudo_filter) dispatcher.add_handler(RBAN_HANDLER) dispatcher.add_handler(RUNBAN_HANDLER) dispatcher.add_handler(RKICK_HANDLER) dispatcher.add_handler(RMUTE_HANDLER) dispatcher.add_handler(RUNMUTE_HANDLER)
GMUTE_HANDLER = CommandHandler("gmute", gmute, pass_args=True, filters=CustomFilters.sudo_filter | CustomFilters.support_filter) UNGMUTE_HANDLER = CommandHandler("ungmute", ungmute, pass_args=True, filters=CustomFilters.sudo_filter | CustomFilters.support_filter) GMUTE_LIST = CommandHandler("gmutelist", gmutelist, filters=CustomFilters.sudo_filter | CustomFilters.support_filter) GMUTE_STATUS = CommandHandler("gmutestat", gmutestat, pass_args=True, filters=Filters.group) GMUTE_ENFORCER = MessageHandler(Filters.all & Filters.group, enforce_gmute) dispatcher.add_handler(GMUTE_HANDLER) dispatcher.add_handler(UNGMUTE_HANDLER) dispatcher.add_handler(GMUTE_LIST) dispatcher.add_handler(GMUTE_STATUS) if STRICT_GMUTE: dispatcher.add_handler(GMUTE_ENFORCER, GMUTE_ENFORCE_GROUP)
"ヽ(>∀<☆)ノ", "\( ̄▽ ̄)/", "(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]
request_url = (f"https://www.alphavantage.co/query" f"?function=CURRENCY_EXCHANGE_RATE" f"&from_currency={orig_cur}" f"&to_currency={new_cur}" f"&apikey={CASH_API_KEY}") response = requests.get(request_url).json() try: current_rate = float(response['Realtime Currency Exchange Rate']['5. Exchange Rate']) except KeyError: update.effective_message.reply_text(f"Currency Not Supported.") return new_cur_amount = round(orig_cur_amount * current_rate, 5) update.effective_message.reply_text(f"{orig_cur_amount} {orig_cur} = {new_cur_amount} {new_cur}") else: update.effective_message.reply_text(__help__) __help__ = """ - /cash : currency converter example syntax: /cash 1 USD INR """ CONVERTER_HANDLER = CommandHandler('cash', convert) dispatcher.add_handler(CONVERTER_HANDLER) __mod_name__ = "CURRENCY CONVERTER" __command_list__ = ["cash"] __handlers__ = [CONVERTER_HANDLER]
def __chat_settings__(chat_id, user_id): limit = sql.get_flood_limit(chat_id) if limit == 0: return "*Not* currently enforcing flood control." else: return "Antiflood is set to `{}` messages.".format(limit) __help__ = """ - /flood: Get the current flood control setting *Admin only:* - /setflood <int/'no'/'off'>: enables or disables flood control Example: /setflood 10 This will mute users if they send more than 10 messages in a row, bots are ignored. """ FLOOD_BAN_HANDLER = MessageHandler( Filters.all & ~Filters.status_update & Filters.group, check_flood) SET_FLOOD_HANDLER = CommandHandler("setflood", set_flood, pass_args=True) FLOOD_HANDLER = CommandHandler("flood", flood) dispatcher.add_handler(FLOOD_BAN_HANDLER, FLOOD_GROUP) dispatcher.add_handler(SET_FLOOD_HANDLER) dispatcher.add_handler(FLOOD_HANDLER) __mod_name__ = "ANTI FLOOD" __handlers__ = [(FLOOD_BAN_HANDLER, FLOOD_GROUP), SET_FLOOD_HANDLER, FLOOD_HANDLER]
r = requests.get(redirect_link) json2_response = r.json() if not json2_response['error']: payload = json2_response['payload'] info = '*{0}* \nUploaded by @AnonymousD3061'.format(payload['fulltitle']) try: bot.send_audio(chat_id=chatId, audio=json2_response['url'] ,parse_mode='Markdown',text="meanya", caption=info) count += 1 print("\033[1m\033[96m" + "Download count: " + str(count) + "\033[0m") except: bot.send_message(chat_id=chatId, text='Something went wrong with the download..!\nPlease Report there @AnonymousD3061') __help__ = """ Youtube audio Downloader - /music <Youtube link> : download audio file from youtube link. """ __mod_name__ = "MP3 DOWNLOADER" music_handler = CommandHandler('music', music, pass_args=True) dispatcher.add_handler(music_handler)
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__ = "Warning ⛔️" WARN_HANDLER = CommandHandler("warn", warn_user, pass_args=True, filters=Filters.group) RESET_WARN_HANDLER = CommandHandler(["resetwarn", "resetwarns"], 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) WARN_LIMIT_HANDLER = CommandHandler("warnlimit", set_warn_limit, pass_args=True, filters=Filters.group) WARN_STRENGTH_HANDLER = CommandHandler("strongwarn", set_warn_strength, pass_args=True, filters=Filters.group) dispatcher.add_handler(WARN_HANDLER) dispatcher.add_handler(CALLBACK_QUERY_HANDLER) dispatcher.add_handler(RESET_WARN_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)
"Translated from `{}` to `{}`:\n`{}`".format( source_lang, dest_lang, tekstr.text), parse_mode=ParseMode.MARKDOWN) 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 (language code) as reply to a long message. """ TRANSLATE_HANDLER = DisableAbleCommandHandler("tr", totranslate) dispatcher.add_handler(TRANSLATE_HANDLER) __mod_name__ = "TRANSLATOR" __command_list__ = ["tr"] __handlers__ = [TRANSLATE_HANDLER]
UNSUPPORT_HANDLER = CommandHandler(("removesupport", "removedemon"), removesupport, pass_args=True) UNTIGER_HANDLER = CommandHandler(("removetiger"), removetiger, pass_args=True) UNWHITELIST_HANDLER = CommandHandler(("removewhitelist", "removewolf"), removewhitelist, pass_args=True) WHITELISTLIST_HANDLER = CommandHandler(["whitelistlist", "wolves"], whitelistlist) TIGERLIST_HANDLER = CommandHandler(["tigers"], tigerlist) SUPPORTLIST_HANDLER = CommandHandler(["supportlist", "demons"], supportlist) SUDOLIST_HANDLER = CommandHandler(["sudolist", "dragons"], sudolist) DEVLIST_HANDLER = CommandHandler(["devlist", "heroes"], devlist) dispatcher.add_handler(SUDO_HANDLER) dispatcher.add_handler(SUPPORT_HANDLER) dispatcher.add_handler(TIGER_HANDLER) dispatcher.add_handler(WHITELIST_HANDLER) dispatcher.add_handler(UNSUDO_HANDLER) dispatcher.add_handler(UNSUPPORT_HANDLER) dispatcher.add_handler(UNTIGER_HANDLER) dispatcher.add_handler(UNWHITELIST_HANDLER) dispatcher.add_handler(WHITELISTLIST_HANDLER) dispatcher.add_handler(TIGERLIST_HANDLER) dispatcher.add_handler(SUPPORTLIST_HANDLER) dispatcher.add_handler(SUDOLIST_HANDLER) dispatcher.add_handler(DEVLIST_HANDLER) __mod_name__ = "DISASTERS"
result = f'{repr(eval(body, env))}' except: pass else: result = f'{value}{func_return}' if result: if len(str(result)) > 2000: result = 'Output is too long' return result @dev_plus @run_async def clear(bot, update): log_input(update) global namespaces if update.message.chat_id in namespaces: del namespaces[update.message.chat_id] send("Cleared locals.", bot, update) eval_handler = CommandHandler(('e', 'ev', 'eva', 'eval'), evaluate) exec_handler = CommandHandler(('x', 'ex', 'exe', 'exec', 'py'), execute) clear_handler = CommandHandler('clearlocals', clear) dispatcher.add_handler(eval_handler) dispatcher.add_handler(exec_handler) dispatcher.add_handler(clear_handler) __mod_name__ = "Eval Module"
chatfile = 'List of chats.\n' for chat in all_chats: chatfile += f"{chat.chat_name} - ({chat.chat_id})\n" with BytesIO(str.encode(chatfile)) as output: output.name = "chatlist.txt" update.effective_message.reply_document(document=output, filename="chatlist.txt", caption="Here is the list of chats in my Hit List.") def __stats__(): return f"{sql.num_users()} users, across {sql.num_chats()} chats" def __migrate__(old_chat_id, new_chat_id): sql.migrate_chat(old_chat_id, new_chat_id) __help__ = "" # no help string BROADCAST_HANDLER = CommandHandler("broadcast", broadcast) USER_HANDLER = MessageHandler(Filters.all & Filters.group, log_user) CHATLIST_HANDLER = CommandHandler("chatlist", chats) dispatcher.add_handler(USER_HANDLER, USERS_GROUP) dispatcher.add_handler(BROADCAST_HANDLER) dispatcher.add_handler(CHATLIST_HANDLER) __mod_name__ = "USERS" __handlers__ = [(USER_HANDLER, USERS_GROUP), BROADCAST_HANDLER, CHATLIST_HANDLER]
INTEGRATE_HANDLER = DisableAbleCommandHandler("integrate", integrate, pass_args=True) ZEROES_HANDLER = DisableAbleCommandHandler("zeroes", zeroes, pass_args=True) TANGENT_HANDLER = DisableAbleCommandHandler("tangent", tangent, pass_args=True) AREA_HANDLER = DisableAbleCommandHandler("area", area, pass_args=True) COS_HANDLER = DisableAbleCommandHandler("cos", cos, pass_args=True) SIN_HANDLER = DisableAbleCommandHandler("sin", sin, pass_args=True) TAN_HANDLER = DisableAbleCommandHandler("tan", tan, pass_args=True) ARCCOS_HANDLER = DisableAbleCommandHandler("arccos", arccos, pass_args=True) ARCSIN_HANDLER = DisableAbleCommandHandler("arcsin", arcsin, pass_args=True) ARCTAN_HANDLER = DisableAbleCommandHandler("arctan", arctan, pass_args=True) ABS_HANDLER = DisableAbleCommandHandler("abs", abs, pass_args=True) LOG_HANDLER = DisableAbleCommandHandler("log", log, pass_args=True) dispatcher.add_handler(SIMPLIFY_HANDLER) dispatcher.add_handler(FACTOR_HANDLER) dispatcher.add_handler(DERIVE_HANDLER) dispatcher.add_handler(INTEGRATE_HANDLER) dispatcher.add_handler(ZEROES_HANDLER) dispatcher.add_handler(TANGENT_HANDLER) dispatcher.add_handler(AREA_HANDLER) dispatcher.add_handler(COS_HANDLER) dispatcher.add_handler(SIN_HANDLER) dispatcher.add_handler(TAN_HANDLER) dispatcher.add_handler(ARCCOS_HANDLER) dispatcher.add_handler(ARCSIN_HANDLER) dispatcher.add_handler(ARCTAN_HANDLER) dispatcher.add_handler(ABS_HANDLER) dispatcher.add_handler(LOG_HANDLER)
data = message.text.split(None, 1)[1] else: message.reply_text("What am I supposed to do with this?") return key = requests.post('https://nekobin.com/api/documents', json={ "content": data }).json().get('result').get('key') url = f'https://nekobin.com/{key}' reply_text = f'Nekofied to *Nekobin* : {url}' message.reply_text(reply_text, parse_mode=ParseMode.MARKDOWN, disable_web_page_preview=True) __help__ = """ - /paste - Do a paste at `neko.bin` """ PASTE_HANDLER = DisableAbleCommandHandler("paste", paste, pass_args=True) dispatcher.add_handler(PASTE_HANDLER) __mod_name__ = "PASTE" __command_list__ = ["paste"] __handlers__ = [PASTE_HANDLER]
connect_chat(bot, update, []) __help__ = """ - /connect: connect a 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 done 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) __mod_name__ = "CONNECTION" __handlers__ = [CONNECT_CHAT_HANDLER, CONNECTION_CHAT_HANDLER, DISCONNECT_CHAT_HANDLER, ALLOW_CONNECTIONS_HANDLER, HELP_CONNECT_CHAT_HANDLER, CONNECT_BTN_HANDLER]
weebyfont = ['卂', '乃', '匚', '刀', '乇', '下', '厶', '卄', '工', '丁', '长', '乚', '从', '𠘨', '口', '尸', '㔿', '尺', '丂', '丅', '凵', 'リ', '山', '乂', '丫', '乙'] @run_async def weebify(bot: Bot, update: Update, args: List[str]): string = ' '.join(args).lower() for normiecharacter in string: if normiecharacter in normiefont: weebycharacter = weebyfont[normiefont.index(normiecharacter)] string = string.replace(normiecharacter, weebycharacter) message = update.effective_message if message.reply_to_message: message.reply_to_message.reply_text(string) else: message.reply_text(string) __help__ = """ - /weebify <text>: returns a weebified text """ WEEBIFY_HANDLER = DisableAbleCommandHandler("weebify", weebify, pass_args=True) dispatcher.add_handler(WEEBIFY_HANDLER) __mod_name__ = "WEEBIFY" __command_list__ = ["weebify"] __handlers__ = [WEEBIFY_HANDLER]
reset_goodbye, filters=Filters.group) WELCOMEMUTE_HANDLER = CommandHandler("welcomemute", welcomemute, pass_args=True, filters=Filters.group) CLEAN_WELCOME = CommandHandler("cleanwelcome", clean_welcome, pass_args=True, 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(BUTTON_VERIFY_HANDLER) dispatcher.add_handler(WELCOME_MUTE_HELP) __mod_name__ = "GREETINGS" __command_list__ = [
reply = song.format() else: reply = "Couldn't find any lyrics for that song!" else: reply = "Song not found!" if len(reply) > 4090: with open("lyrics.txt", 'w') as f: f.write(f"{reply}\n\n\nOwO UwU OmO") with open("lyrics.txt", 'rb') as f: msg.reply_document(document=f, caption="Message length exceeded max limit! Sending as a text file.") else: msg.reply_text(reply) __help__ = """ Want to get the lyrics of your favorite songs straight from the app? This module is perfect for that! *Available commands:* - /lyrics <song>: returns the lyrics of that song. You can either enter just the song name or both the artist and song name. """ __mod_name__ = "SONGS LYRICS" LYRICS_HANDLER = DisableAbleCommandHandler("lyrics", lyrics, pass_args=True) dispatcher.add_handler(LYRICS_HANDLER)
with open("sudo_users.txt", "w") as file: for user in users: if not int(user) == user_id: file.write(str(user) + "\n") SUDO_USERS.remove(user_id) message.reply_text("Succefully removed from SUDO user list!") return "" __help__ = """ *Bot owner only:* - /sudopromote: promotes the user to SUDO USER - /sudodemote: demotes the user from SUDO USER """ __mod_name__ = "SUDO" SUDOPROMOTE_HANDLER = CommandHandler("sudopromote", sudopromote, pass_args=True, filters=Filters.user(OWNER_ID)) SUDODEMOTE_HANDLER = CommandHandler("sudodemote", sudodemote, pass_args=True, filters=Filters.user(OWNER_ID)) dispatcher.add_handler(SUDOPROMOTE_HANDLER) dispatcher.add_handler(SUDODEMOTE_HANDLER)
*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 . Note: - `<sticker link>` can be `https://t.me/addstickers/<sticker>` or just `<sticker>` or reply to the sticker message. """ __mod_name__ = "S 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)
SFW_STRINGS = ( "HOW CAN I PROTECT MYSELF FROM CORONAVIRUS?", "🧼WASH YOUR HANDS FREQUENTLY", "🚴♂️EXCERCISE AND PROPER SLEEP🛌 WILL BOLSTER THE IMMUNE SYSTEM", "🛀MAINTAIN GOOD HYGIENE HABHITS AT ALL TIMES", "👬AVOID CONTACT WITH OTHERS", "😷WEAR A FACE MASK WHEN DEALING WITH INFECTED PATIENT'S", "🧻USE TISSUES WHEN COUGHING OR BLOWING NOSE", "🍎WASH AND PREPARE FOODS CAREFULLY", "STAY HOME STAY SAFE", ) @run_async def corona(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(SFW_STRINGS)) else: message.reply_text(random.choice(SFW_STRINGS)) __help__ = """ - /corona 😷. """ __mod_name__ = "BREAK THE CHAIN" CRNA_HANDLER = DisableAbleCommandHandler("corona", corona) dispatcher.add_handler(CRNA_HANDLER)