# Made By @Madepranav On Telegram & Github Id Superboyfan import random from telegram import Update from telegram.ext import CallbackContext, run_async import DaisyX.modules.animequotesstring as animequotesstring from DaisyX import dispatcher from DaisyX.modules.disable import DisableAbleCommandHandler @run_async def animequotes(update: Update, context: CallbackContext): update.effective_message.reply_text(random.choice(animequotesstring.ANIMEQUOTES)) ANIMEQUOTES_HANDLER = DisableAbleCommandHandler("animequotes", animequotes) dispatcher.add_handler(ANIMEQUOTES_HANDLER)
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]
If you set Log Channels, you will get logs of Silent kick and bans. Check *Logger* module to know more about Log Channel. """ BAN_HANDLER = CommandHandler("ban", ban) TEMPBAN_HANDLER = CommandHandler(["tban"], temp_ban) STEMPBAN_HANDLER = CommandHandler(["stban"], stemp_ban) KICK_HANDLER = CommandHandler("kick", kick) SKICK_HANDLER = CommandHandler("skick", skick) UNBAN_HANDLER = CommandHandler("unban", unban) ROAR_HANDLER = CommandHandler("roar", selfunban) KICKME_HANDLER = DisableAbleCommandHandler("kickme", kickme, filters=Filters.group) SBAN_HANDLER = CommandHandler("sban", sban) dispatcher.add_handler(BAN_HANDLER) dispatcher.add_handler(TEMPBAN_HANDLER) dispatcher.add_handler(STEMPBAN_HANDLER) dispatcher.add_handler(KICK_HANDLER) dispatcher.add_handler(SKICK_HANDLER) dispatcher.add_handler(UNBAN_HANDLER) dispatcher.add_handler(ROAR_HANDLER) dispatcher.add_handler(KICKME_HANDLER) dispatcher.add_handler(SBAN_HANDLER) __mod_name__ = "Bans 🛑" __handlers__ = [ BAN_HANDLER, TEMPBAN_HANDLER, STEMPBAN_HANDLER, KICK_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("DaisyX.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"
*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,
RMPIRO_HANDLER = CommandHandler(("rmpiro", "removesudo"), rmpiro) UNSUDO_HANDLER = CommandHandler(("removesudo", "removedragon"), removesudo) UNSUPPORT_HANDLER = CommandHandler(("removesupport", "removedemon"), removesupport) UNTIGER_HANDLER = CommandHandler(("removetiger"), removetiger) UNWHITELIST_HANDLER = CommandHandler(("removewhitelist", "removewolf"), removewhitelist) 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(DEV_HANDLER) dispatcher.add_handler(SUDO_HANDLER) dispatcher.add_handler(SUPPORT_HANDLER) dispatcher.add_handler(TIGER_HANDLER) dispatcher.add_handler(WHITELIST_HANDLER) dispatcher.add_handler(RMPIRO_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)
✪ /flood*:* Get the current flood control setting *Admin only:* ✪ /setflood <int/'no'/'off'>: enables or disables flood control ✪ /setfloodmode <ban/kick/mute/tban/tmute> <value>: Action to perform when user have exceeded flood limit. ban/kick/mute/tmute/tban Note: - Value must be filled for tban and tmute! It can be: 5m = 5 minutes 6h = 6 hours 3d = 3 days 1w = 1 week """ __mod_name__ = "Antiflood" FLOOD_BAN_HANDLER = MessageHandler( Filters.all & ~Filters.status_update & Filters.group, check_flood ) SET_FLOOD_HANDLER = CommandHandler( "setflood", set_flood, pass_args=True ) # , filters=Filters.group) SET_FLOOD_MODE_HANDLER = CommandHandler( "setfloodmode", set_flood_mode, pass_args=True ) # , filters=Filters.group) FLOOD_HANDLER = CommandHandler("flood", flood) # , filters=Filters.group) dispatcher.add_handler(FLOOD_BAN_HANDLER, FLOOD_GROUP) dispatcher.add_handler(SET_FLOOD_HANDLER) dispatcher.add_handler(SET_FLOOD_MODE_HANDLER) dispatcher.add_handler(FLOOD_HANDLER)
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) 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)
✪ /mute <userhandle>*:* silences a user. Can also be used as a reply, muting the replied to user. ✪ /smute <userhandle>*:* silences a user without notifying. 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`. ✪ /stmute <userhandle> x(m/h/d)*:* mutes a user for x time without notifying. (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. _NOTE:_ If you set Log Channels, you will get logs of Silent mutes. Check *Logger* module to know more about Log Channel. """ MUTE_HANDLER = CommandHandler("mute", mute) SMUTE_HANDLER = CommandHandler("smute", smute) UNMUTE_HANDLER = CommandHandler("unmute", unmute) TEMPMUTE_HANDLER = CommandHandler(["tmute", "tempmute"], temp_mute) STEMPMUTE_HANDLER = CommandHandler(["stmute", "stempmute"], stemp_mute) dispatcher.add_handler(MUTE_HANDLER) dispatcher.add_handler(SMUTE_HANDLER) dispatcher.add_handler(UNMUTE_HANDLER) dispatcher.add_handler(TEMPMUTE_HANDLER) dispatcher.add_handler(STEMPMUTE_HANDLER) __mod_name__ = "Muting" __handlers__ = [ MUTE_HANDLER, SMUTE_HANDLER, UNMUTE_HANDLER, TEMPMUTE_HANDLER, TEMPMUTE_HANDLER, ]
import requests from telegram import ParseMode, Update from telegram.ext import CallbackContext, run_async from DaisyX import dispatcher from DaisyX.modules.disable import DisableAbleCommandHandler @run_async def covid(update: Update, context: CallbackContext): message = update.effective_message text = message.text.split(" ", 1) if len(text) == 1: r = requests.get("https://corona.lmao.ninja/v2/all").json() reply_text = f"**Global Totals** Ъда\nCases: {r['cases']:,}\nCases Today: {r['todayCases']:,}\nDeaths: {r['deaths']:,}\nDeaths Today: {r['todayDeaths']:,}\nRecovered: {r['recovered']:,}\nActive: {r['active']:,}\nCritical: {r['critical']:,}\nCases/Mil: {r['casesPerOneMillion']}\nDeaths/Mil: {r['deathsPerOneMillion']}" else: variabla = text[1] r = requests.get( f"https://corona.lmao.ninja/v2/countries/{variabla}").json() reply_text = f"**Cases for {r['country']} Ъда**\nCases: {r['cases']:,}\nCases Today: {r['todayCases']:,}\nDeaths: {r['deaths']:,}\nDeaths Today: {r['todayDeaths']:,}\nRecovered: {r['recovered']:,}\nActive: {r['active']:,}\nCritical: {r['critical']:,}\nCases/Mil: {r['casesPerOneMillion']}\nDeaths/Mil: {r['deathsPerOneMillion']}" message.reply_text(reply_text, parse_mode=ParseMode.MARKDOWN) COVID_HANDLER = DisableAbleCommandHandler(["covid", "corona"], covid) dispatcher.add_handler(COVID_HANDLER)
Reply 2 %%% 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)
bot.answer_callback_query(query.id) if query_type == "db_leave_chat": if query.from_user.id in admin_list: bot.editMessageText("Leaving chats ...", chat_id, message.message_id) chat_count = get_muted_chats(update, context, True) bot.sendMessage(chat_id, f"Left {chat_count} chats.") else: query.answer("You are not allowed to use this.") elif query_type == "db_cleanup": if query.from_user.id in admin_list: bot.editMessageText("Cleaning up DB ...", chat_id, message.message_id) invalid_chat_count = get_invalid_chats(update, context, True) invalid_gban_count = get_invalid_gban(update, context, True) reply = "Cleaned up {} chats and {} gbanned users from db.".format( invalid_chat_count, invalid_gban_count ) bot.sendMessage(chat_id, reply) else: query.answer("You are not allowed to use this.") DB_CLEANUP_HANDLER = CommandHandler("dbcleanup", dbcleanup) BUTTON_HANDLER = CallbackQueryHandler(callback_button, pattern="db_.*") dispatcher.add_handler(DB_CLEANUP_HANDLER) dispatcher.add_handler(BUTTON_HANDLER) __mod_name__ = "DB Cleanup" __handlers__ = [DB_CLEANUP_HANDLER, BUTTON_HANDLER]
*Admin only:* - /tagall: mention all subscribed members. - /untagall: clears all subscribed members. - /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)
""" __mod_name__ = "Filters" FILTER_HANDLER = CommandHandler("filter", filters) STOP_HANDLER = CommandHandler("stop", stop_filter) RMALLFILTER_HANDLER = CommandHandler("removeallfilters", rmall_filters, filters=Filters.group) RMALLFILTER_CALLBACK = CallbackQueryHandler(rmall_callback, pattern=r"filters_.*") LIST_HANDLER = DisableAbleCommandHandler("filters", list_handlers, admin_ok=True) CUST_FILTER_HANDLER = MessageHandler( CustomFilters.has_text & ~Filters.update.edited_message, reply_filter) dispatcher.add_handler(FILTER_HANDLER) dispatcher.add_handler(STOP_HANDLER) dispatcher.add_handler(LIST_HANDLER) dispatcher.add_handler(CUST_FILTER_HANDLER, HANDLER_GROUP) dispatcher.add_handler(RMALLFILTER_HANDLER) dispatcher.add_handler(RMALLFILTER_CALLBACK) __handlers__ = [ FILTER_HANDLER, STOP_HANDLER, LIST_HANDLER, (CUST_FILTER_HANDLER, HANDLER_GROUP, RMALLFILTER_HANDLER), ]
• `/unlock <type>`*:* Unlock items of a certain type (not available in private) • `/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)
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]
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)
__help__ = """ ✪ /report <reason>*:* reply to a message to report it to admins. ✪ `@admin`*:* reply to a message to report it to admins. *NOTE:* Neither of these will get triggered if used by admins. *Admins only:* ✪ /reports <on/off>*:* change report setting, or view current status. • If done in pm, toggles your status. • If in group, toggles that groups's status. """ SETTING_HANDLER = CommandHandler("reports", report_setting) REPORT_HANDLER = CommandHandler("report", report, filters=Filters.group) ADMIN_REPORT_HANDLER = MessageHandler(Filters.regex(r"(?i)@admin(s)?"), report) REPORT_BUTTON_USER_HANDLER = CallbackQueryHandler(buttons, pattern=r"report_") dispatcher.add_handler(REPORT_BUTTON_USER_HANDLER) dispatcher.add_handler(SETTING_HANDLER) dispatcher.add_handler(REPORT_HANDLER, REPORT_GROUP) dispatcher.add_handler(ADMIN_REPORT_HANDLER, REPORT_GROUP) __mod_name__ = "Reporting ⚠️" __handlers__ = [ (REPORT_HANDLER, REPORT_GROUP), (ADMIN_REPORT_HANDLER, REPORT_GROUP), (SETTING_HANDLER), ]
args = context.args update.effective_message if len(args) == 0: update.effective_message.reply_text( "That was a funny joke, but no really, put in a location") try: geolocator = Nominatim(user_agent="SkittBot") location = " ".join(args) geoloc = geolocator.geocode(location) chat_id = update.effective_chat.id lon = geoloc.longitude lat = geoloc.latitude the_loc = Location(lon, lat) gm = "https://www.google.com/maps/search/{},{}".format(lat, lon) dispatcher.bot.send_location(chat_id, location=the_loc) update.message.reply_text( "Open with: [Google Maps]({})".format(gm), parse_mode=ParseMode.MARKDOWN, disable_web_page_preview=True, ) except AttributeError: update.message.reply_text("I can't find that") GPS_HANDLER = CommandHandler("gps", gps) dispatcher.add_handler(GPS_HANDLER) __command_list__ = ["Gps"] __handlers__ = [GPS_HANDLER]
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 f"This chat has had it's rules set: `{bool(sql.get_rules(chat_id))}`" __help__ = """ ✪ /rules*:* get the rules for this chat. *Admins only:* ✪ /setrules <your rules here>*:* set the rules for this chat. ✪ /clearrules*:* clear the rules for this chat. """ __mod_name__ = "Rules" GET_RULES_HANDLER = CommandHandler("rules", get_rules, filters=Filters.group) SET_RULES_HANDLER = CommandHandler("setrules", set_rules, filters=Filters.group) RESET_RULES_HANDLER = CommandHandler("clearrules", clear_rules, filters=Filters.group) dispatcher.add_handler(GET_RULES_HANDLER) dispatcher.add_handler(SET_RULES_HANDLER) dispatcher.add_handler(RESET_RULES_HANDLER)
msg.reply_text(f"An error occurred! Report this @{SUPPORT_CHAT}") else: wallpapers = json_rep.get("wallpapers") if not wallpapers: msg.reply_text("No results found! Refine your search.") return else: index = randint(0, len(wallpapers) - 1) # Choose random index wallpaper = wallpapers[index] wallpaper = wallpaper.get("url_image") wallpaper = wallpaper.replace("\\", "") bot.send_photo( chat_id, photo=wallpaper, caption="Preview", reply_to_message_id=msg_id, timeout=60, ) bot.send_document( chat_id, document=wallpaper, filename="wallpaper", caption=caption, reply_to_message_id=msg_id, timeout=60, ) WALLPAPER_HANDLER = DisableAbleCommandHandler("wall", wall) dispatcher.add_handler(WALLPAPER_HANDLER)
FACTOR_HANDLER = DisableAbleCommandHandler("factor", factor) DERIVE_HANDLER = DisableAbleCommandHandler("derive", derive) INTEGRATE_HANDLER = DisableAbleCommandHandler("integrate", integrate) ZEROES_HANDLER = DisableAbleCommandHandler("zeroes", zeroes) TANGENT_HANDLER = DisableAbleCommandHandler("tangent", tangent) AREA_HANDLER = DisableAbleCommandHandler("area", area) COS_HANDLER = DisableAbleCommandHandler("cos", cos) SIN_HANDLER = DisableAbleCommandHandler("sin", sin) TAN_HANDLER = DisableAbleCommandHandler("tan", tan) ARCCOS_HANDLER = DisableAbleCommandHandler("arccos", arccos) ARCSIN_HANDLER = DisableAbleCommandHandler("arcsin", arcsin) ARCTAN_HANDLER = DisableAbleCommandHandler("arctan", arctan) ABS_HANDLER = DisableAbleCommandHandler("abs", abs) LOG_HANDLER = DisableAbleCommandHandler("log", log) 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)
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("DaisyX.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)
slist, filters=Filters.user(OWNER_ID)) REDDIT_MEMES_HANDLER = DisableAbleCommandHandler("rmeme", rmemes) GITHUB_HANDLER = DisableAbleCommandHandler("git", github, admin_ok=True) REPO_HANDLER = DisableAbleCommandHandler("repo", repo, pass_args=True, admin_ok=True) PASTE_HANDLER = DisableAbleCommandHandler("paste", paste, pass_args=True) GET_PASTE_HANDLER = DisableAbleCommandHandler("getpaste", get_paste_content, pass_args=True) FPASTE_HANDLER = CommandHandler("fpaste", fpaste, pass_args=True) dispatcher.add_handler(APP_HANDLER) dispatcher.add_handler(LYRICS_HANDLER) dispatcher.add_handler(GITHUB_HANDLER) dispatcher.add_handler(REPO_HANDLER) dispatcher.add_handler(PASTE_HANDLER) dispatcher.add_handler(GET_PASTE_HANDLER) dispatcher.add_handler(UD_HANDLER) dispatcher.add_handler(ECHO_HANDLER) dispatcher.add_handler(MD_HELP_HANDLER) dispatcher.add_handler(STATS_HANDLER) dispatcher.add_handler(GDPR_HANDLER) dispatcher.add_handler(WIKI_HANDLER) dispatcher.add_handler(GETLINK_HANDLER) dispatcher.add_handler(STAFFLIST_HANDLER) dispatcher.add_handler(REDDIT_MEMES_HANDLER) dispatcher.add_handler(GIFID_HANDLER)
filters=Filters.group) WELCOMEMUTE_HANDLER = CommandHandler("welcomemute", welcomemute, filters=Filters.group) CLEAN_SERVICE_HANDLER = CommandHandler("cleanservice", cleanservice, filters=Filters.group) CLEAN_WELCOME = CommandHandler("cleanwelcome", clean_welcome, filters=Filters.group) WELCOME_HELP = CommandHandler("welcomehelp", welcome_help) WELCOME_MUTE_HELP = CommandHandler("welcomemutehelp", welcome_mute_help) BUTTON_VERIFY_HANDLER = CallbackQueryHandler(user_button, pattern=r"user_join_") dispatcher.add_handler(NEW_MEM_HANDLER) dispatcher.add_handler(LEFT_MEM_HANDLER) dispatcher.add_handler(WELC_PREF_HANDLER) dispatcher.add_handler(GOODBYE_PREF_HANDLER) dispatcher.add_handler(SET_WELCOME) dispatcher.add_handler(SET_GOODBYE) dispatcher.add_handler(RESET_WELCOME) dispatcher.add_handler(RESET_GOODBYE) dispatcher.add_handler(CLEAN_WELCOME) dispatcher.add_handler(WELCOME_HELP) dispatcher.add_handler(WELCOMEMUTE_HANDLER) dispatcher.add_handler(CLEAN_SERVICE_HANDLER) dispatcher.add_handler(BUTTON_VERIFY_HANDLER) dispatcher.add_handler(WELCOME_MUTE_HELP) __mod_name__ = "Greetings 🙏"
html.escape(fst_name), html.escape(user.reason)) update.effective_message.reply_text(res, parse_mode="html") __help__ = """ • `/afk <reason>`*:* mark yourself as AFK(away from keyboard). • `brb <reason>`*:* same as the afk command - but not a command. When marked as AFK, any mentions will be replied to with a message to say you're not available! """ 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), (AFK_REGEX_HANDLER, AFK_GROUP), (NO_AFK_HANDLER, AFK_GROUP), (AFK_REPLY_HANDLER, AFK_REPLY_GROUP), ]
def main(): if SUPPORT_CHAT is not None and isinstance(SUPPORT_CHAT, str): try: dispatcher.bot.sendMessage(f"@{SUPPORT_CHAT}", "I am now online!") 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, pass_args=True) 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_") about_callback_handler = CallbackQueryHandler( DaisyX_about_callback, pattern=r"aboutmanu_" ) donate_handler = CommandHandler("donate", donate) migrate_handler = MessageHandler(Filters.status_update.migrate, migrate_chats) is_chat_allowed_handler = MessageHandler(Filters.group, is_chat_allowed) # dispatcher.add_handler(test_handler) dispatcher.add_handler(start_handler) dispatcher.add_handler(about_callback_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(is_chat_allowed_handler) dispatcher.add_handler(donate_handler) dispatcher.add_error_handler(error_handler) if WEBHOOK: LOGGER.info("Using webhooks.") updater.start_webhook(listen="0.0.0.0", port=PORT, url_path=TOKEN) if CERT_PATH: updater.bot.set_webhook(url=URL + TOKEN, certificate=open(CERT_PATH, "rb")) else: updater.bot.set_webhook(url=URL + TOKEN) client.run_until_disconnected() else: LOGGER.info("Using long polling.") updater.start_polling(timeout=15, read_latency=4, clean=True) if len(argv) not in (1, 3, 4): telethn.disconnect() else: telethn.run_until_disconnected() updater.idle()
• `/kaizoku <anime>`*:* search an anime on animekaizoku.com • `/kayo <anime>`*:* search an anime on animekayo.com • `/airing <anime>`*:* returns anime airing info. """ 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) dispatcher.add_handler(KAIZOKU_SEARCH_HANDLER) dispatcher.add_handler(KAYO_SEARCH_HANDLER) dispatcher.add_handler(UPCOMING_HANDLER) __command_list__ = [ "anime", "manga", "character", "user", "upcoming",
""" 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__ = "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,
# 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__ = "St-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)