return if success: msg.reply_text( "Sticker pack successfully created. Get it [here](t.me/addstickers/%s)" % packname, parse_mode=ParseMode.MARKDOWN, ) else: msg.reply_text( "Failed to create sticker pack. Possibly due to blek mejik.") __help__ = """ • `/stickerid`*:* reply to a sticker to me to tell you its file ID. • `/getsticker`*:* reply to a sticker to me to upload its raw PNG file. • `/kang`*:* reply to a sticker to add it to your pack. • `/stickers`*:* Find stickers for given term on combot sticker catalogue """ __mod_name__ = "Stickers" STICKERID_HANDLER = DisableAbleCommandHandler("stickerid", stickerid) GETSTICKER_HANDLER = DisableAbleCommandHandler("getsticker", getsticker) KANG_HANDLER = DisableAbleCommandHandler("kang", kang, admin_ok=True) STICKERS_HANDLER = DisableAbleCommandHandler("stickers", cb_sticker) dispatcher.add_handler(STICKERS_HANDLER) dispatcher.add_handler(STICKERID_HANDLER) dispatcher.add_handler(GETSTICKER_HANDLER) dispatcher.add_handler(KANG_HANDLER)
• `/killme`*:* kills the user who issued the command *Admins only:* • `/ban <userhandle>`*:* bans a user. (via handle, or reply) • `/tban <userhandle> x(m/h/d)`*:* bans a user for `x` time. (via handle, or reply). `m` = `minutes`, `h` = `hours`, `d` = `days`. • `/unban <userhandle>`*:* unbans a user. (via handle, or reply) • `/kill <userhandle>`*:* killes a user out of the group, (via handle, or reply) """ BAN_HANDLER = CommandHandler("ban", ban) TEMPBAN_HANDLER = CommandHandler(["tban"], temp_ban) kill_HANDLER = CommandHandler("kill", kill) UNBAN_HANDLER = CommandHandler("unban", unban) ROAR_HANDLER = CommandHandler("roar", selfunban) killME_HANDLER = DisableAbleCommandHandler("killme", killme, filters=Filters.group) dispatcher.add_handler(BAN_HANDLER) dispatcher.add_handler(TEMPBAN_HANDLER) dispatcher.add_handler(kill_HANDLER) dispatcher.add_handler(UNBAN_HANDLER) dispatcher.add_handler(ROAR_HANDLER) dispatcher.add_handler(killME_HANDLER) __mod_name__ = "Bans" __handlers__ = [ BAN_HANDLER, TEMPBAN_HANDLER, kill_HANDLER, UNBAN_HANDLER, ROAR_HANDLER, killME_HANDLER ]
Reply 3` • `/clear <notename>`*:* clear note with this name • `/removeallnotes`*:* removes all notes from the group *Note:* Note names are case-insensitive, and they are automatically converted to lowercase before getting saved. """ __mod_name__ = "Notes" GET_HANDLER = CommandHandler("get", cmd_get) HASH_GET_HANDLER = MessageHandler(Filters.regex(r"^#[^\s]+"), hash_get) SLASH_GET_HANDLER = MessageHandler(Filters.regex(r"^/\d+$"), slash_get) SAVE_HANDLER = CommandHandler("save", save) DELETE_HANDLER = CommandHandler("clear", clear) LIST_HANDLER = DisableAbleCommandHandler(["notes", "saved"], list_notes, admin_ok=True) CLEARALL = DisableAbleCommandHandler("removeallnotes", clearall) CLEARALL_BTN = CallbackQueryHandler(clearall_btn, pattern=r"notes_.*") 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) dispatcher.add_handler(CLEARALL) dispatcher.add_handler(CLEARALL_BTN)
""" SET_CLEAN_BLUE_TEXT_HANDLER = CommandHandler("cleanblue", set_blue_text_must_click) ADD_CLEAN_BLUE_TEXT_HANDLER = CommandHandler("ignoreblue", add_bluetext_ignore) REMOVE_CLEAN_BLUE_TEXT_HANDLER = CommandHandler("unignoreblue", remove_bluetext_ignore) ADD_CLEAN_BLUE_TEXT_GLOBAL_HANDLER = CommandHandler( "gignoreblue", add_bluetext_ignore_global) REMOVE_CLEAN_BLUE_TEXT_GLOBAL_HANDLER = CommandHandler( "ungignoreblue", remove_bluetext_ignore_global) 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) ]
f"- {event.from_id} ({event.chat_id}) : {event.text} | {datetime.datetime.now()}" ) support_chat = os.getenv('SUPPORT_CHAT') @run_async @dev_plus def logs(update: Update, context: CallbackContext): chat_username = update.effective_chat.username if not chat_username: return if chat_username != support_chat: return user = update.effective_user with open('log.txt', 'rb') as f: context.bot.send_document(document=f, filename=f.name, chat_id=user.id) LOG_HANDLER = CommandHandler('logs', logs) dispatcher.add_handler(LOG_HANDLER) DEBUG_HANDLER = CommandHandler("debug", debug) dispatcher.add_handler(DEBUG_HANDLER) __mod_name__ = "Debug" __command_list__ = ["debug"] __handlers__ = [DEBUG_HANDLER]
unload_messasge.edit_text(f"Successfully unloaded module : <b>{text}</b>", parse_mode=ParseMode.HTML) @run_async @sudo_plus def listmodules(update: Update, context: CallbackContext): message = update.effective_message module_list = [] for helpable_module in HELPABLE: helpable_module_info = IMPORTED[helpable_module] file_info = IMPORTED[helpable_module_info.__mod_name__.lower()] file_name = file_info.__name__.rsplit("LightYagami.modules.", 1)[1] mod_name = file_info.__mod_name__ module_list.append(f'- <code>{mod_name} ({file_name})</code>\n') module_list = "Following modules are loaded : \n\n" + ''.join(module_list) message.reply_text(module_list, parse_mode=ParseMode.HTML) LOAD_HANDLER = CommandHandler("load", load) UNLOAD_HANDLER = CommandHandler("unload", unload) LISTMODULES_HANDLER = CommandHandler("listmodules", listmodules) dispatcher.add_handler(LOAD_HANDLER) dispatcher.add_handler(UNLOAD_HANDLER) dispatcher.add_handler(LISTMODULES_HANDLER) __mod_name__ = "Modules"
return results def scam(imgspage, lim): """Parse/Scrape the HTML code for the info we want.""" single = opener.open(imgspage).read() decoded = single.decode('utf-8') if int(lim) > 10: lim = 10 imglinks = [] counter = 0 pattern = r'^,\[\"(.*[.png|.jpg|.jpeg])\",[0-9]+,[0-9]+\]$' oboi = re.findall(pattern, decoded, re.I | re.M) for imglink in oboi: counter += 1 imglinks.append(imglink) if counter >= int(lim): break return imglinks REVERSE_HANDLER = DisableAbleCommandHandler( "reverse", reverse, pass_args=True, admin_ok=True ) dispatcher.add_handler(REVERSE_HANDLER)
*Commands:* *Admins only:* • `/addchat`*:* Enables Chatbot mode in the chat. • `/rmchat`*:* Disables Chatbot mode in the chat. Reports bugs at @{SUPPORT_CHAT} *Powered by CoffeeHouse* (https://coffeehouse.intellivoid.net/) from @Intellivoid """ ADD_CHAT_HANDLER = CommandHandler("addchat", add_chat) REMOVE_CHAT_HANDLER = CommandHandler("rmchat", remove_chat) CHATBOT_HANDLER = MessageHandler( Filters.text & (~Filters.regex(r"^#[^\s]+") & ~Filters.regex(r"^!") & ~Filters.regex(r"^\/")), chatbot) LIST_CB_CHATS_HANDLER = CommandHandler("listaichats", list_chatbot_chats, filters=CustomFilters.dev_filter) # Filters for ignoring #note messages, !commands and sed. dispatcher.add_handler(ADD_CHAT_HANDLER) dispatcher.add_handler(REMOVE_CHAT_HANDLER) dispatcher.add_handler(CHATBOT_HANDLER) dispatcher.add_handler(LIST_CB_CHATS_HANDLER) __mod_name__ = "Chatbot" __command_list__ = ["addchat", "rmchat", "listaichats"] __handlers__ = [ ADD_CHAT_HANDLER, REMOVE_CHAT_HANDLER, CHATBOT_HANDLER, LIST_CB_CHATS_HANDLER ]
✪ /unapprove*:* Unapprove of a user. They will now be subject to locks, blacklists, and antiflood again. ✪ /approved*:* List all approved users. ✪ /unapproveall*:* Unapprove ALL users in a chat. This cannot be undone. \ """ APPROVED_HANDLER = DisableAbleCommandHandler("approved", approved, filters=Filters.group) UNAPPROVE_ALL_HANDLER = DisableAbleCommandHandler("unapproveall", unapproveall, filters=Filters.group) APPROVE_HANDLER = DisableAbleCommandHandler("approve", approve, pass_args=True, filters=Filters.group) UNAPPROVE_HANDLER = DisableAbleCommandHandler("unapprove", unapprove, pass_args=True, filters=Filters.group) APPROVEL_HANDLER = DisableAbleCommandHandler("approval", approval, pass_args=True, filters=Filters.group) dispatcher.add_handler(APPROVED_HANDLER) dispatcher.add_handler(UNAPPROVE_ALL_HANDLER) dispatcher.add_handler(APPROVE_HANDLER) dispatcher.add_handler(UNAPPROVE_HANDLER) dispatcher.add_handler(APPROVEL_HANDLER)
- /addtag <userhandle>: add a user to chat tag list. (via handle, or reply) - /removetag <userhandle>: remove a user to chat tag list. (via handle, or reply) """ TAG_ALL_HANDLER = DisableAbleCommandHandler("tagall", tagall, filters=Filters.group) UNTAG_ALL_HANDLER = DisableAbleCommandHandler("untagall", untagall, filters=Filters.group) UNTAG_ME_HANDLER = CommandHandler("untagme", untagme, filters=Filters.group) TAG_ME_HANDLER = CommandHandler("tagme", tagme, filters=Filters.group) ADD_TAG_HANDLER = DisableAbleCommandHandler("addtag", addtag, pass_args=True, filters=Filters.group) REMOVE_TAG_HANDLER = DisableAbleCommandHandler("removetag", removetag, pass_args=True, filters=Filters.group) TAGALL_CALLBACK_HANDLER = CallbackQueryHandler(tagg_all_button, pattern=r"tagall_") dispatcher.add_handler(TAG_ALL_HANDLER) dispatcher.add_handler(UNTAG_ALL_HANDLER) dispatcher.add_handler(UNTAG_ME_HANDLER) dispatcher.add_handler(TAG_ME_HANDLER) dispatcher.add_handler(ADD_TAG_HANDLER) dispatcher.add_handler(REMOVE_TAG_HANDLER) dispatcher.add_handler(TAGALL_CALLBACK_HANDLER)
stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) stdout, stderr = process.communicate() reply = '' stderr = stderr.decode() stdout = stdout.decode() if stdout: reply += f"*Stdout*\n`{stdout}`\n" LOGGER.info(f"Shell - {cmd} - {stdout}") if stderr: reply += f"*Stderr*\n`{stderr}`\n" LOGGER.error(f"Shell - {cmd} - {stderr}") if len(reply) > 3000: with open('shell_output.txt', 'w') as file: file.write(reply) with open('shell_output.txt', 'rb') as doc: context.bot.send_document(document=doc, filename=doc.name, reply_to_message_id=message.message_id, chat_id=message.chat_id) else: message.reply_text(reply, parse_mode=ParseMode.MARKDOWN) SHELL_HANDLER = CommandHandler(['sh'], shell) dispatcher.add_handler(SHELL_HANDLER) __mod_name__ = "Shell" __command_list__ = ['sh'] __handlers__ = [SHELL_HANDLER]
import requests from LightYagami import dispatcher from LightYagami.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]
def tts(update: Update, context: CallbackContext): args = context.args current_time = datetime.strftime(datetime.now(), "%d.%m.%Y %H:%M:%S") filename = datetime.now().strftime("%d%m%y-%H%M%S%f") reply = " ".join(args) update.message.chat.send_action(ChatAction.RECORD_AUDIO) lang = "ml" tts = gTTS(reply, lang) tts.save("k.mp3") with open("k.mp3", "rb") as f: linelist = list(f) linecount = len(linelist) if linecount == 1: update.message.chat.send_action(ChatAction.RECORD_AUDIO) lang = "en" tts = gTTS(reply, lang) tts.save("k.mp3") with open("k.mp3", "rb") as speech: update.message.reply_voice(speech, quote=False) __help__ = """ - /tts <text>: convert text to speech """ TTS_HANDLER = DisableAbleCommandHandler("tts", tts, pass_args=True) dispatcher.add_handler(TTS_HANDLER) __mod_name__ = "Tts" __command_list__ = ["tts"] __handlers__ = [TTS_HANDLER]
CLASSIC_HANDLER = CommandHandler("classic", classic) KUNI_HANDLER = CommandHandler("kuni", kuni) WAIFU_HANDLER = CommandHandler("waifu", waifu) LEWD_HANDLER = CommandHandler("lewd", lewd) KISS_HANDLER = CommandHandler("kiss", kiss) FEMDOM_HANDLER = CommandHandler("femdom", femdom) CUDDLE_HANDLER = CommandHandler("hug", hug) EROK_HANDLER = CommandHandler("erok", erok) FOXGIRL_HANDLER = CommandHandler("foxgirl", foxgirl) TITSGIF_HANDLER = CommandHandler("titsgif", titsgif) ERO_HANDLER = CommandHandler("ero", ero) SMUG_HANDLER = CommandHandler("smug", smug) BAKA_HANDLER = CommandHandler("baka", baka) DVA_HANDLER = CommandHandler("dva", dva) 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)
for i in reversed(range(5)): sent_msg.edit_text(sent_msg_text + str(i + 1)) sleep(1) sent_msg.edit_text("Restarted.") os.system('restart.bat') os.execv('start.bat', sys.argv) @run_async @dev_plus def restart(update: Update, context: CallbackContext): update.effective_message.reply_text( "Starting a new instance and shutting down this one") os.system('restart.bat') os.execv('start.bat', sys.argv) LEAVE_HANDLER = CommandHandler("leave", leave) GITPULL_HANDLER = CommandHandler("gitpull", gitpull) RESTART_HANDLER = CommandHandler("reboot", restart) dispatcher.add_handler(LEAVE_HANDLER) dispatcher.add_handler(GITPULL_HANDLER) dispatcher.add_handler(RESTART_HANDLER) __mod_name__ = "Dev" __handlers__ = [LEAVE_HANDLER, GITPULL_HANDLER, RESTART_HANDLER]
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("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}") elif len(args) == 1: update.effective_message.reply_text(__help__, parse_mode=ParseMode.MARKDOWN) else: update.effective_message.reply_text( f"*Invalid Args!!:* Required 3 But Passed {len(args) -1}", parse_mode=ParseMode.MARKDOWN) CONVERTER_HANDLER = CommandHandler('cash', convert) dispatcher.add_handler(CONVERTER_HANDLER) __command_list__ = ["cash"] __handlers__ = [CONVERTER_HANDLER]
FVRT_CHAR_HANDLER = DisableAbleCommandHandler(["characterlist", "fcl"], fvrtchar) REMOVE_WATCHLIST_HANDLER = DisableAbleCommandHandler( ["removewatchlist", "rwl"], removewatchlist) REMOVE_FVRT_CHAR_HANDLER = DisableAbleCommandHandler(["rfcharacter", "rfcl"], removefvrtchar) REMOVE_MANGA_CHAR_HANDLER = DisableAbleCommandHandler(["rmanga", "rml"], removemangalist) BUTTON_HANDLER = CallbackQueryHandler(button, pattern='anime_.*') ANIME_STUFFS_HANDLER = CallbackQueryHandler(animestuffs, pattern='xanime_.*') KAIZOKU_SEARCH_HANDLER = DisableAbleCommandHandler("kaizoku", kaizoku) KAYO_SEARCH_HANDLER = DisableAbleCommandHandler("kayo", kayo) GANIME_SEARCH_HANDLER = DisableAbleCommandHandler("ganime", ganime) MEME_HANDLER = DisableAbleCommandHandler("meme", meme) dispatcher.add_handler(BUTTON_HANDLER) dispatcher.add_handler(ANIME_STUFFS_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) dispatcher.add_handler(UPCOMING_HANDLER) dispatcher.add_handler(WATCHLIST_HANDLER) dispatcher.add_handler(MANGALIST_HANDLER) dispatcher.add_handler(FVRT_CHAR_HANDLER) dispatcher.add_handler(REMOVE_FVRT_CHAR_HANDLER) dispatcher.add_handler(REMOVE_MANGA_CHAR_HANDLER) dispatcher.add_handler(REMOVE_WATCHLIST_HANDLER) dispatcher.add_handler(KAIZOKU_SEARCH_HANDLER) dispatcher.add_handler(KAYO_SEARCH_HANDLER)
*What is that health thingy?* Come and see [HP System explained](https://t.me/OnePunchUpdates/192) """ SET_BIO_HANDLER = DisableAbleCommandHandler("setbio", set_about_bio) GET_BIO_HANDLER = DisableAbleCommandHandler("bio", about_bio) STATS_HANDLER = CommandHandler("stats", stats) ID_HANDLER = DisableAbleCommandHandler("id", get_id) GIFID_HANDLER = DisableAbleCommandHandler("gifid", gifid) INFO_HANDLER = DisableAbleCommandHandler(("info", "book"), info) SET_ABOUT_HANDLER = DisableAbleCommandHandler("setme", set_about_me) GET_ABOUT_HANDLER = DisableAbleCommandHandler("me", about_me) dispatcher.add_handler(STATS_HANDLER) dispatcher.add_handler(ID_HANDLER) dispatcher.add_handler(GIFID_HANDLER) dispatcher.add_handler(INFO_HANDLER) dispatcher.add_handler(SET_BIO_HANDLER) dispatcher.add_handler(GET_BIO_HANDLER) dispatcher.add_handler(SET_ABOUT_HANDLER) dispatcher.add_handler(GET_ABOUT_HANDLER) __mod_name__ = "Info" __command_list__ = ["setbio", "bio", "setme", "me", "info"] __handlers__ = [ ID_HANDLER, GIFID_HANDLER, INFO_HANDLER, SET_BIO_HANDLER, GET_BIO_HANDLER, SET_ABOUT_HANDLER, GET_ABOUT_HANDLER, STATS_HANDLER ]
def load(update: Update, context: CallbackContext): message = update.effective_message text = message.text.split(" ", 1)[1] load_messasge = message.reply_text( f"Attempting to load module : <b>{text}</b>", parse_mode=ParseMode.HTML) try: imported_module = importlib.import_module("LightYagami.modules." + text) except: load_messasge.edit_text("Does that module even exist?") return if not hasattr(imported_module, "__mod_name__"): imported_module.__mod_name__ = imported_module.__name__ if not imported_module.__mod_name__.lower() in IMPORTED: IMPORTED[imported_module.__mod_name__.lower()] = imported_module else: load_messasge.edit_text("Module already loaded.") return if "__handlers__" in dir(imported_module): handlers = imported_module.__handlers__ for handler in handlers: if not isinstance(handler, tuple): dispatcher.add_handler(handler) else: if isinstance(handler[0], collections.Callable): callback, telethon_event = handler telethn.add_event_handler(callback, telethon_event) else: handler_name, priority = handler dispatcher.add_handler(handler_name, priority) else: IMPORTED.pop(imported_module.__mod_name__.lower()) load_messasge.edit_text("The module cannot be loaded.") return if hasattr(imported_module, "__help__") and imported_module.__help__: HELPABLE[imported_module.__mod_name__.lower()] = imported_module # Chats to migrate on chat_migrated events if hasattr(imported_module, "__migrate__"): MIGRATEABLE.append(imported_module) if hasattr(imported_module, "__stats__"): STATS.append(imported_module) if hasattr(imported_module, "__user_info__"): USER_INFO.append(imported_module) if hasattr(imported_module, "__import_data__"): DATA_IMPORT.append(imported_module) if hasattr(imported_module, "__export_data__"): DATA_EXPORT.append(imported_module) if hasattr(imported_module, "__chat_settings__"): CHAT_SETTINGS[imported_module.__mod_name__.lower()] = imported_module if hasattr(imported_module, "__user_settings__"): USER_SETTINGS[imported_module.__mod_name__.lower()] = imported_module load_messasge.edit_text( "Successfully loaded module : <b>{}</b>".format(text), parse_mode=ParseMode.HTML)
pass __help__ = """ • `/addrss <link>`*:* add an RSS link to the subscriptions. • `/removerss <link>`*:* removes the RSS link from the subscriptions. • `/rss <link>`*:* shows the link's data and the last entry, for testing purposes. • `/listrss`*:* shows the list of rss feeds that the chat is currently subscribed to. *NOTE:* In groups, only admins can add/remove RSS links to the group's subscription """ __mod_name__ = "RSS Feed" job = updater.job_queue job_rss_set = job.run_once(rss_set, 5) job_rss_update = job.run_repeating(rss_update, interval=60, first=60) job_rss_set.enabled = True job_rss_update.enabled = True SHOW_URL_HANDLER = CommandHandler("rss", show_url) ADD_URL_HANDLER = CommandHandler("addrss", add_url) REMOVE_URL_HANDLER = CommandHandler("removerss", remove_url) LIST_URLS_HANDLER = CommandHandler("listrss", list_urls) dispatcher.add_handler(SHOW_URL_HANDLER) dispatcher.add_handler(ADD_URL_HANDLER) dispatcher.add_handler(REMOVE_URL_HANDLER) dispatcher.add_handler(LIST_URLS_HANDLER)
y = 896 image = Image.new('RGBA', [x, y], (0, 0, 0)) for character in msg: value = thonkifydict.get(character) addedimg = Image.new('RGBA', [x + value.size[0] + tracking.size[0], y], (0, 0, 0)) addedimg.paste(image, [0, 0]) addedimg.paste(tracking, [x, 0]) addedimg.paste(value, [x + tracking.size[0], 0]) image = addedimg x = x + value.size[0] + tracking.size[0] maxsize = 1024, 896 if image.size[0] > maxsize[0]: image.thumbnail(maxsize, Image.ANTIALIAS) # put processed image in a buffer and then upload cause async with BytesIO() as buffer: buffer.name = 'image.png' image.save(buffer, 'PNG') buffer.seek(0) context.bot.send_sticker(chat_id=message.chat_id, sticker=buffer) PLET_HANDLER = DisableAbleCommandHandler("plet", plet) dispatcher.add_handler(PLET_HANDLER) __handlers__ = [ PLET_HANDLER ]
try: result = f'{repr(eval(body, env))}' except: pass else: result = f'{value}{func_return}' if result: return result @dev_plus @run_async def clear(update: Update, context: CallbackContext): bot = context.bot 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"
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"
return name = bot.get_chat(user).first_name text = f"<b>Common chats with {name}</b>\n" for chat in common_list: try: chat_name = bot.get_chat(chat).title sleep(0.3) text += f"• <code>{chat_name}</code>\n" except BadRequest: pass except Unauthorized: pass except RetryAfter as e: sleep(e.retry_after) if len(text) < 4096: msg.reply_text(text, parse_mode="HTML") else: with open("common_chats.txt", 'w') as f: f.write(text) with open("common_chats.txt", 'rb') as f: msg.reply_document(f) os.remove("common_chats.txt") COMMON_CHATS_HANDLER = CommandHandler("getchats", get_user_common_chats, filters=Filters.user(OWNER_ID)) dispatcher.add_handler(COMMON_CHATS_HANDLER)
def main(): if SUPPORT_CHAT is not None and isinstance(SUPPORT_CHAT, str): try: dispatcher.bot.sendMessage(f"@{SUPPORT_CHAT}", "Time To Write Names On Death Note") 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 = CommandHandler("test", test) start_handler = CommandHandler("start", start) help_handler = CommandHandler("help", get_help) help_callback_handler = CallbackQueryHandler(help_button, pattern=r"help_.*") settings_handler = CommandHandler("settings", get_settings) settings_callback_handler = CallbackQueryHandler(settings_button, pattern=r"stngs_") donate_handler = CommandHandler("donate", donate) 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(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("Using long polling.") updater.start_polling(timeout=15, read_latency=4, clean=True) if len(argv) not in (1, 3, 4): telethn.disconnect() else: telethn.run_until_disconnected() updater.idle()
Blacklist sticker is used to stop certain stickers. Whenever a sticker is sent, the message will be deleted immediately. *NOTE:* Blacklist stickers do not affect the group admin • `/blsticker`*:* See current blacklisted sticker *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 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)
• `/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__ = "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) 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)
is_blacklisted = sql.is_user_blacklisted(user_id) text = "Blacklisted: <b>{}</b>" if user_id in [777000, 1087968824]: return "" if user_id == dispatcher.bot.id: return "" if int(user_id) in DRAGONS + TIGERS + WOLVES: return "" 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 BL_HANDLER = CommandHandler("ignore", bl_user) UNBL_HANDLER = CommandHandler("notice", unbl_user) BLUSERS_HANDLER = CommandHandler("ignoredlist", bl_users) dispatcher.add_handler(BL_HANDLER) dispatcher.add_handler(UNBL_HANDLER) dispatcher.add_handler(BLUSERS_HANDLER) __mod_name__ = "Blacklisting Users" __handlers__ = [BL_HANDLER, UNBL_HANDLER, BLUSERS_HANDLER]
else: message.reply_text(string) SANITIZE_HANDLER = DisableAbleCommandHandler("sanitize", sanitize) RUNS_HANDLER = DisableAbleCommandHandler("runs", runs) SLAP_HANDLER = DisableAbleCommandHandler("slap", slap) PAT_HANDLER = DisableAbleCommandHandler("pat", pat) TOSS_HANDLER = DisableAbleCommandHandler("toss", toss) BLUETEXT_HANDLER = DisableAbleCommandHandler("bluetext", bluetext) RLG_HANDLER = DisableAbleCommandHandler("rlg", rlg) TABLE_HANDLER = DisableAbleCommandHandler("table", table) SHOUT_HANDLER = DisableAbleCommandHandler("shout", shout) WEEBIFY_HANDLER = DisableAbleCommandHandler("weebify", weebify) dispatcher.add_handler(WEEBIFY_HANDLER) dispatcher.add_handler(SHOUT_HANDLER) dispatcher.add_handler(SANITIZE_HANDLER) dispatcher.add_handler(RUNS_HANDLER) dispatcher.add_handler(SLAP_HANDLER) dispatcher.add_handler(PAT_HANDLER) dispatcher.add_handler(TOSS_HANDLER) dispatcher.add_handler(BLUETEXT_HANDLER) dispatcher.add_handler(RLG_HANDLER) dispatcher.add_handler(TABLE_HANDLER) __command_list__ = [ "runs", "slap", "toss", "bluetext",
CLAP_HANDLER = DisableAbleCommandHandler("clap", clapmoji) OWO_HANDLER = DisableAbleCommandHandler("owo", owo) STRECH_HANDLER = DisableAbleCommandHandler("stretch", stretch) RECITE_HANDLER = DisableAbleCommandHandler("recite", recite) DICE_HANDLER = DisableAbleCommandHandler("roll", dice) YESNOWTF_HANDLER = DisableAbleCommandHandler("decide", yesnowtf) GDMORNING_HANDLER = DisableAbleMessageHandler( Filters.regex(r"(?i)(goodmorning|good morning)"), goodmorning, friendly="goodmorning") GDNIGHT_HANDLER = DisableAbleMessageHandler( Filters.regex(r"(?i)(goodnight|good night)"), goodnight, friendly="goodnight") dispatcher.add_handler(PAT_HANDLER) dispatcher.add_handler(SHOUT_HANDLER) dispatcher.add_handler(DARE_HANDLER) dispatcher.add_handler(TRUTH_HANDLER) dispatcher.add_handler(GBAM_HANDLER) dispatcher.add_handler(SHRUG_HANDLER) dispatcher.add_handler(DECIDE_HANDLER) dispatcher.add_handler(ABUSE_HANDLER) dispatcher.add_handler(RUNS_HANDLER) dispatcher.add_handler(SLAP_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)