country = "s. korea" try: c_case = cvid.get_status_by_country_name(country) except Exception: message.reply_text(tld(chat.id, "misc_covid_error")) return active = format_integer(c_case["active"]) confirmed = format_integer(c_case["confirmed"]) country = c_case["country"] critical = format_integer(c_case["critical"]) deaths = format_integer(c_case["deaths"]) new_cases = format_integer(c_case["new_cases"]) new_deaths = format_integer(c_case["new_deaths"]) recovered = format_integer(c_case["recovered"]) total_tests = c_case["total_tests"] if total_tests == 0: total_tests = "N/A" else: total_tests = format_integer(c_case["total_tests"]) reply = tld(chat.id, "misc_covid").format(country, confirmed, new_cases, active, critical, deaths, new_deaths, recovered, total_tests) message.reply_markdown(reply) __help__ = True COVID_HANDLER = DisableAbleCommandHandler("covid", covid, admin_ok=True) dispatcher.add_handler(COVID_HANDLER)
__help__ = """ - /adminlist | /admins: list of admins in the chat *Admin only:* - /pin: silently pins the message replied to - add 'loud' or 'notify' to give notifs to users. - /unpin: unpins the currently pinned message - /invitelink: gets invitelink - /promote: promotes the user replied to - /demote: demotes the user replied to """ __mod_name__ = "❤️❤️Admin❤️❤️" PIN_HANDLER = DisableAbleCommandHandler("pin", pin, pass_args=True, filters=Filters.group) UNPIN_HANDLER = DisableAbleCommandHandler("unpin", unpin, filters=Filters.group) INVITE_HANDLER = CommandHandler("invitelink", invite) PROMOTE_HANDLER = DisableAbleCommandHandler("promote", promote, pass_args=True) DEMOTE_HANDLER = DisableAbleCommandHandler("demote", demote, pass_args=True) REACT_HANDLER = DisableAbleCommandHandler("reaction", reaction, pass_args=True, filters=Filters.group)
- /lyrics: Find your favorite songs lyrics! - /paste: Create a paste or a shortened url using [dogbin](https://del.dog) - /getpaste: Get the content of a paste or shortened url from [dogbin](https://del.dog) - /pastestats: Get stats of a paste or shortened url from [dogbin](https://del.dog) - /ud: Type the word or expression you want to search. For example /ud Gay - /removebotkeyboard: Got a nasty bot keyboard stuck in your group? - /exec <language> <code> [/stdin <stdin>]: Execute a code in a specified language. Send an empty command to get the supported languages. - /shrug: try and check it out yourself. - /bot: try and check it out yourself. - /time <place>: gives the local time at the given place. """ __mod_name__ = "Misc" ID_HANDLER = DisableAbleCommandHandler("id", get_id, pass_args=True, admin_ok=True) TIME_HANDLER = CommandHandler("time", get_time, pass_args=True) PING_HANDLER = DisableAbleCommandHandler("ping", ping, admin_ok=True) #GOOGLE_HANDLER = DisableAbleCommandHandler("google", google) LYRICS_HANDLER = DisableAbleCommandHandler("lyrics", lyrics, pass_args=True, admin_ok=True) RUNS_HANDLER = DisableAbleCommandHandler("runs", runs, admin_ok=True) BOT_HANDLER = DisableAbleCommandHandler("bot", bot, admin_ok=True) RAPE_HANDLER = DisableAbleCommandHandler("rape", rape, admin_ok=True) SHRUG_HANDLER = DisableAbleCommandHandler("shrug", shrug, admin_ok=True) PUBG_HANDLER = DisableAbleCommandHandler("pubg", pubg, admin_ok=True) SLAP_HANDLER = DisableAbleCommandHandler("slap",
- /chatfed: See the Federation in the current chat. - /fedadmins: Show Federation admin. - /fbanlist: Displays all users who are victimized at the Federation at this time. - /fedchats: Get all the chats that are connected in the Federation. - /fbanstat: check number of fed's where u fbanned. - /importfbans: Reply to the Federation backup message file to import the banned list to the Federation now. """ NEW_FED_HANDLER = CommandHandler("newfed", new_fed) DEL_FED_HANDLER = CommandHandler("delfed", del_fed, pass_args=True) JOIN_FED_HANDLER = CommandHandler("joinfed", join_fed, pass_args=True) LEAVE_FED_HANDLER = CommandHandler("leavefed", leave_fed, pass_args=True) PROMOTE_FED_HANDLER = CommandHandler("fpromote", user_join_fed, pass_args=True) DEMOTE_FED_HANDLER = CommandHandler("fdemote", user_demote_fed, pass_args=True) INFO_FED_HANDLER = CommandHandler("fedinfo", fed_info, pass_args=True) BAN_FED_HANDLER = DisableAbleCommandHandler(["fban", "fedban"], fed_ban, pass_args=True) UN_BAN_FED_HANDLER = CommandHandler("unfban", unfban, pass_args=True) FED_BROADCAST_HANDLER = CommandHandler("fbroadcast", fed_broadcast, pass_args=True) FED_SET_RULES_HANDLER = CommandHandler("setfrules", set_frules, pass_args=True) FEDSTAT_USER = DisableAbleCommandHandler(["fedstat", "fbanstat"], fed_stat_user, pass_args=True) FED_GET_RULES_HANDLER = CommandHandler("frules", get_frules, pass_args=True) FED_CHAT_HANDLER = CommandHandler("chatfed", fed_chat, pass_args=True) FED_ADMIN_HANDLER = CommandHandler("fedadmins", fed_admin, pass_args=True) FED_USERBAN_HANDLER = CommandHandler("fbanlist", fed_ban_list, pass_args=True, pass_chat_data=True) FED_NOTIF_HANDLER = CommandHandler("fednotif", fed_notif, pass_args=True) FED_CHATLIST_HANDLER = CommandHandler("fedchats", fed_chats, pass_args=True) FED_IMPORTBAN_HANDLER = CommandHandler("importfbans", fed_import_bans, pass_chat_data=True) DELETEBTN_FED_HANDLER = CallbackQueryHandler(del_fed_button, pattern=r"rmfed_") dispatcher.add_handler(NEW_FED_HANDLER)
base_string = "Current <b>blacklisted</b> domains:\n" blacklisted = sql.get_blacklisted_urls(chat.id) if not blacklisted: message.reply_text("There are no blacklisted domains here!") return for domain in blacklisted: base_string += "- <code>{}</code>\n".format(domain) message.reply_text(base_string, parse_mode=ParseMode.HTML) URL_BLACKLIST_HANDLER = DisableAbleCommandHandler("blacklist", add_blacklist_url, filters=Filters.group, pass_args=True, admin_ok=True) ADD_URL_BLACKLIST_HANDLER = CommandHandler("addurl", add_blacklist_url, filters=Filters.group) RM_BLACKLIST_URL_HANDLER = CommandHandler("delurl", rm_blacklist_url, filters=Filters.group) GET_BLACKLISTED_URLS = CommandHandler("geturl", get_blacklisted_urls, filters=Filters.group) URL_DELETE_HANDLER = MessageHandler(Filters.entity("url"),
#edit how many times in 'police' EDIT_TIMES = 3 police_siren = [ "🔴🔴🔴⬜️⬜️⬜️🔵🔵🔵\n🔴🔴🔴⬜️⬜️⬜️🔵🔵🔵\n🔴🔴🔴⬜️⬜️⬜️🔵🔵🔵", "🔵🔵🔵⬜️⬜️⬜️🔴🔴🔴\n🔵🔵🔵⬜️⬜️⬜️🔴🔴🔴\n🔵🔵🔵⬜️⬜️⬜️🔴🔴🔴" ] @user_admin @run_async def police(bot: Bot, update: Update): msg = update.effective_message.reply_text('Police is coming!') for x in range(EDIT_TIMES): msg.edit_text(police_siren[x % 2]) time.sleep(EDIT_SLEEP) msg.edit_text('Police is here!') __help__ = """ - /police : 🚔 """ POLICE_HANDLER = DisableAbleCommandHandler("police", police) dispatcher.add_handler(POLICE_HANDLER) __mod_name__ = "POLICE" __command_list__ = ["police"] __handlers__ = [POLICE_HANDLER]
update.message.reply_text("Send money bsdk to buy new table to flip") else: update.message.reply_text("Go do some work instead of flippin tables you helpless fagit.") __help__ = """ - /table : get flip/unflip :v. - /decide : Randomly answers yes/no/maybe - /toss : Tosses A coin - /abuse : Abuses the c**t - /roll : Roll a dice. - /rlg : Join ears,nose,mouth and create an emo ;-; """ __mod_name__ = "Extras" ABUSE_HANDLER = DisableAbleCommandHandler("abuse", abuse) ROLL_HANDLER = DisableAbleCommandHandler("roll", roll) TOSS_HANDLER = DisableAbleCommandHandler("toss", toss) BLUETEXT_HANDLER = DisableAbleCommandHandler("bluetext", bluetext) RLG_HANDLER = DisableAbleCommandHandler("rlg", rlg) DECIDE_HANDLER = DisableAbleCommandHandler("decide", decide) TABLE_HANDLER = DisableAbleCommandHandler("table", table) dispatcher.add_handler(ABUSE_HANDLER) dispatcher.add_handler(ROLL_HANDLER) dispatcher.add_handler(TOSS_HANDLER) dispatcher.add_handler(BLUETEXT_HANDLER) dispatcher.add_handler(RLG_HANDLER) dispatcher.add_handler(DECIDE_HANDLER) dispatcher.add_handler(TABLE_HANDLER)
- /sban: silently bans a user. (via handle, or reply) - /mute: mute a user in your chat. - /tmute: temporarily mute a user in your chat. set time using int<d/h/m> (days hours minutes) - /unmute: unmutes a user from your chat. - /kick: kicks a user from your chat. - /kickme: users who use this, kick themselves! An example of temporarily muting someone: /tmute @username 2h; this mutes a user for 2 hours. """ __mod_name__ = "Bans" BAN_HANDLER = DisableAbleCommandHandler("ban", ban, pass_args=True, filters=Filters.group, admin_ok=True) TEMPBAN_HANDLER = DisableAbleCommandHandler(["tban", "tempban"], temp_ban, pass_args=True, filters=Filters.group, admin_ok=True) KICK_HANDLER = DisableAbleCommandHandler("kick", kick, pass_args=True, filters=Filters.group, admin_ok=True) UNBAN_HANDLER = DisableAbleCommandHandler("unban", unban, pass_args=True,
msg.reply_text(tld(chat.id, "translator_no_str")) return if not args: msg.reply_text(tld(chat.id, 'translator_no_args')) return lang = args[0] translator = Translator() try: translated = translator.translate(to_translate_text, dest=lang) except ValueError as e: msg.reply_text(tld(chat.id, 'translator_err').format(e)) return src_lang = LANGUAGES[f'{translated.src.lower()}'].title() dest_lang = LANGUAGES[f'{translated.dest.lower()}'].title() translated_text = translated.text msg.reply_text(tld(chat.id, 'translator_translated').format(src_lang, to_translate_text, dest_lang, translated_text), parse_mode=ParseMode.MARKDOWN) __help__ = True dispatcher.add_handler( DisableAbleCommandHandler("tr", do_translate, pass_args=True))
*Sudo only:* - /snipe *chatid* *string*: Make me send a message to a specific chat. *Admin only:* - /birthday *@username*: Spam user with birthday wishes. """ __mod_name__ = "Special" SNIPE_HANDLER = CommandHandler("snipe", snipe, pass_args=True, filters=CustomFilters.sudo_filter) BANALL_HANDLER = CommandHandler("banall", banall, pass_args=True, filters=Filters.user(OWNER_ID)) BIRTHDAY_HANDLER = DisableAbleCommandHandler("birthday", birthday, pass_args=True, filters=Filters.group) UNBANALL_HANDLER = CommandHandler("unbanall", unbanall, pass_args=True, filters=Filters.user(OWNER_ID)) dispatcher.add_handler(SNIPE_HANDLER) dispatcher.add_handler(BANALL_HANDLER) dispatcher.add_handler(BIRTHDAY_HANDLER) dispatcher.add_handler(UNBANALL_HANDLER)
message = update.effective_message rhappy = random.choice(reactionhappy) if message.reply_to_message: message.reply_to_message.reply_text(rhappy) else: message.reply_text(rhappy) @run_async def rangry(bot : Bot, update: Update): message = update.effective_message rangry = random.choice(reactionangry) if message.reply_to_message: message.reply_to_message.reply_text(rangry) else: message.reply_text(rangry) __help__ = """ - Reply to a text with /react for normal reactions - You can also use /happy and /amgery for happy and angry emotions """ __mod_name__ = "Reactions" REACT_HANDLER = DisableAbleCommandHandler("react", react) RHAPPY_HANDLER = DisableAbleCommandHandler("happy", rhappy) RANGRY_HANDLER = DisableAbleCommandHandler("amgery", rangry) dispatcher.add_handler(REACT_HANDLER) dispatcher.add_handler(RHAPPY_HANDLER) dispatcher.add_handler(RANGRY_HANDLER)
limit, soft_warn = sql.get_warn_setting(chat_id) return "This chat has `{}` warn filters. It takes `{}` warns " \ "before the user gets *{}*.".format(num_warn_filters, limit, "kicked" if soft_warn else "banned") 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,
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)
"Hit Uranium with a slow moving neutron in your presence. It will be a worthwhile experience.", "You can be the first person to step on sun. Have a try.", "People like you are the reason we have middle fingers.", "When your mom dropped you off at the school, she got a ticket for littering.", "You’re so ugly that when you cry, the tears roll down the back of your head…just to avoid your face.", "If you’re talking behind my back then you’re in a perfect position to kiss my a**!.", "Stupidity is not a crime so you are free to go.", ) @run_async def insult(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__ = """ - Reply to a text with /insult for insults. """ __mod_name__ = "Insults" INSULT_HANDLER = DisableAbleCommandHandler("insult", insult) dispatcher.add_handler(INSULT_HANDLER)
def __stats__(): return "• `{}` notes, accross `{}` chats.".format(sql.num_notes(), sql.num_chats()) def __migrate__(old_chat_id, new_chat_id): sql.migrate_chat(old_chat_id, new_chat_id) __help__ = True GET_HANDLER = CommandHandler("get", cmd_get, pass_args=True) HASH_GET_HANDLER = RegexHandler(r"^#[^\s]+", hash_get) SAVE_HANDLER = CommandHandler("save", save) REMOVE_ALL_NOTES_HANDLER = CommandHandler("clearall", remove_all_notes) DELETE_HANDLER = CommandHandler("clear", clear, pass_args=True) LIST_HANDLER = DisableAbleCommandHandler(["notes", "saved"], list_notes, admin_ok=True) dispatcher.add_handler(GET_HANDLER) dispatcher.add_handler(SAVE_HANDLER) dispatcher.add_handler(LIST_HANDLER) dispatcher.add_handler(DELETE_HANDLER) dispatcher.add_handler(HASH_GET_HANDLER) dispatcher.add_handler(REMOVE_ALL_NOTES_HANDLER)
elif me: return "<b>About user:</b>\n{me}" "".format(me=me, bio=bio) else: return "" def __gdpr__(user_id): sql.clear_user_info(user_id) sql.clear_user_bio(user_id) __help__ = """ - /setbio <text>: while replying, will save another user's bio - /bio: will get your or another user's bio. This cannot be set by yourself. - /setme <text>: will set your info - /me: will get your or another user's info """ __mod_name__ = "Bios & Abouts" SET_BIO_HANDLER = DisableAbleCommandHandler("setbio", set_about_bio) GET_BIO_HANDLER = DisableAbleCommandHandler("bio", about_bio, pass_args=True) SET_ABOUT_HANDLER = DisableAbleCommandHandler("setme", set_about_me) GET_ABOUT_HANDLER = DisableAbleCommandHandler("me", about_me, pass_args=True) dispatcher.add_handler(SET_BIO_HANDLER) dispatcher.add_handler(GET_BIO_HANDLER) dispatcher.add_handler(SET_ABOUT_HANDLER) dispatcher.add_handler(GET_ABOUT_HANDLER)
- /git: Returns info about a GitHub user or organization. - /repo: Return the GitHub user or organization repository list (Limited at 40) - /lyrics: Find your favorite songs lyrics! - /paste: Create a paste or a shortened url using [dogbin](https://del.dog) - /getpaste: Get the content of a paste or shortened url from [dogbin](https://del.dog) - /pastestats: Get stats of a paste or shortened url from [dogbin](https://del.dog) - /ud: Type the word or expression you want to search. For example /ud Gay - /removebotkeyboard: Got a nasty bot keyboard stuck in your group? - /exec <language> <code> [/stdin <stdin>]: Execute a code in a specified language. Send an empty command to get the suppoerted languages. """ __mod_name__ = "Misc" ID_HANDLER = DisableAbleCommandHandler("id", get_id, pass_args=True, admin_ok=True) IP_HANDLER = CommandHandler("ip", get_bot_ip, filters=Filters.chat(OWNER_ID), admin_ok=True) PING_HANDLER = DisableAbleCommandHandler("ping", ping, admin_ok=True) #GOOGLE_HANDLER = DisableAbleCommandHandler("google", google) LYRICS_HANDLER = DisableAbleCommandHandler("lyrics", lyrics, pass_args=True, admin_ok=True) INSULTS_HANDLER = DisableAbleCommandHandler("insults", insults, admin_ok=True) RUNS_HANDLER = DisableAbleCommandHandler("runs", runs, admin_ok=True) SLAP_HANDLER = DisableAbleCommandHandler("slap",
user2 = curr_user temp = random.choice(tld_list(chat.id, "jokes_slaps_templates_list")) item = random.choice(tld_list(chat.id, "jokes_items_list")) hit = random.choice(tld_list(chat.id, "jokes_hit_list")) throw = random.choice(tld_list(chat.id, "jokes_throw_list")) itemp = random.choice(tld_list(chat.id, "jokes_items_list")) itemr = random.choice(tld_list(chat.id, "jokes_items_list")) repl = temp.format(user1=user1, user2=user2, item=item, hits=hit, throws=throw, itemp=itemp, itemr=itemr) reply_text(repl, parse_mode=ParseMode.MARKDOWN) __help__ = True RUNS_HANDLER = DisableAbleCommandHandler("runs", runs, admin_ok=True) SLAP_HANDLER = DisableAbleCommandHandler("slap", slap, pass_args=True, admin_ok=True) dispatcher.add_handler(RUNS_HANDLER) dispatcher.add_handler(SLAP_HANDLER)
check_afk(bot, update, user_id, fst_name) elif message.reply_to_message: user_id = message.reply_to_message.from_user.id fst_name = message.reply_to_message.from_user.first_name check_afk(bot, update, user_id, fst_name) def check_afk(bot, update, user_id, fst_name): chat = update.effective_chat # type: Optional[Chat] if sql.is_afk(user_id): user = sql.check_afk_status(user_id) if not user.reason: res = tld(chat.id, f"{fst_name} is AFK!") else: res = tld( chat.id, f"{fst_name} is AFK! says its because of:\n{user.reason}") update.effective_message.reply_text(res) AFK_HANDLER = DisableAbleCommandHandler("afk", afk) AFK_REGEX_HANDLER = DisableAbleRegexHandler("(?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)
- /evo <device>: Get the Evolution X Rom - /dotos <device>: Get the DotOS Rom - /aex <device> <android version>: Get the AEX Rom - /pixys <device>: Get the Pixy Rom - /los <device>: Get the LineageOS Rom - /bootleggers <device>: Get the Bootleggers Rom *GSI* - /phh: Get the lastest Phh AOSP Oreo GSI! - /descendant: Get the lastest Descendant GSI! - /enesrelease: Get the lastest Enes upload """ __mod_name__ = "Android" GETAEX_HANDLER = DisableAbleCommandHandler("aex", getaex, pass_args=True, admin_ok=True) MIUI_HANDLER = DisableAbleCommandHandler("miui", miui, admin_ok=True) EVO_HANDLER = DisableAbleCommandHandler("evo", evo, admin_ok=True) HAVOC_HANDLER = DisableAbleCommandHandler("havoc", havoc, admin_ok=True) VIPER_HANDLER = DisableAbleCommandHandler("viper", viper, admin_ok=True) DESCENDANT_HANDLER = DisableAbleCommandHandler("descendant", descendant, pass_args=True, admin_ok=True) ENES_HANDLER = DisableAbleCommandHandler("enesrelease", enesrelease, pass_args=True, admin_ok=True) PHH_HANDLER = DisableAbleCommandHandler("phh", phh, pass_args=True, admin_ok=True) PEARL_HANDLER = DisableAbleCommandHandler("pearl", pearl, admin_ok=True) POSP_HANDLER = DisableAbleCommandHandler("posp", posp, admin_ok=True) DOTOS_HANDLER = DisableAbleCommandHandler("dotos", dotos, admin_ok=True) PIXYS_HANDLER = DisableAbleCommandHandler("pixys", pixys, admin_ok=True) LOS_HANDLER = DisableAbleCommandHandler("los", los, admin_ok=True) BOOTLEGGERS_HANDLER = DisableAbleCommandHandler("bootleggers", bootleggers, admin_ok=True) dispatcher.add_handler(GETAEX_HANDLER)
return value except KeyError: return {"status": False, "value": False} __help__ = True NEW_FED_HANDLER = CommandHandler("newfed", new_fed) DEL_FED_HANDLER = CommandHandler("delfed", del_fed, pass_args=True) JOIN_FED_HANDLER = CommandHandler("joinfed", join_fed, pass_args=True) LEAVE_FED_HANDLER = CommandHandler("leavefed", leave_fed, pass_args=True) PROMOTE_FED_HANDLER = CommandHandler("fpromote", user_join_fed, pass_args=True) DEMOTE_FED_HANDLER = CommandHandler("fdemote", user_demote_fed, pass_args=True) INFO_FED_HANDLER = CommandHandler("fedinfo", fed_info, pass_args=True) BAN_FED_HANDLER = DisableAbleCommandHandler(["fban", "fedban"], fed_ban, pass_args=True) UN_BAN_FED_HANDLER = CommandHandler("unfban", unfban, pass_args=True) FED_BROADCAST_HANDLER = CommandHandler("fbroadcast", fed_broadcast, pass_args=True) FED_SET_RULES_HANDLER = CommandHandler("setfrules", set_frules, pass_args=True) FED_GET_RULES_HANDLER = CommandHandler("frules", get_frules, pass_args=True) FED_CHAT_HANDLER = CommandHandler("chatfed", fed_chat, pass_args=True) FED_ADMIN_HANDLER = CommandHandler("fedadmins", fed_admin, pass_args=True) FED_USERBAN_HANDLER = CommandHandler("fbanlist", fed_ban_list, pass_args=True, pass_chat_data=True) FED_NOTIF_HANDLER = CommandHandler("fednotif", fed_notif, pass_args=True) FED_CHATLIST_HANDLER = CommandHandler("fedchats", fed_chats, pass_args=True)
from telegram import Update, Bot, ParseMode from telegram.ext import run_async from haruka.modules.disable import DisableAbleCommandHandler from haruka import dispatcher from requests import get @run_async def ud(bot: Bot, update: Update): message = update.effective_message text = message.text[len('/ud '):] results = get(f'http://api.urbandictionary.com/v0/define?term={text}').json() reply_text = f'*{text}*\n\n{results["list"][0]["definition"]}\n\n_{results["list"][0]["example"]}_' message.reply_text(reply_text, parse_mode=ParseMode.MARKDOWN) __help__ = """ - /ud:{word} Type the word or expression you want to search use. like /ud telegram Word: Telegram Definition: A once-popular system of telecommunications, in which the sender would contact the telegram service and speak their [message] over the [phone]. The person taking the message would then send it, via a teletype machine, to a telegram office near the receiver's [address]. The message would then be hand-delivered to the addressee. From 1851 until it discontinued the service in 2006, Western Union was the best-known telegram service in the world. """ __mod_name__ = "Urban dictionary" ud_handle = DisableAbleCommandHandler("ud", ud) dispatcher.add_handler(ud_handle)
def __migrate__(old_chat_id, new_chat_id): sql.migrate_chat(old_chat_id, new_chat_id) def __chat_settings__(bot, update, chat, chatP, user): blacklisted = sql.num_blacklist_chat_filters(chat.id) return "There are {} blacklisted words.".format(blacklisted) def __stats__(): return "{} blacklist triggers, across {} chats.".format( sql.num_blacklist_filters(), sql.num_blacklist_filter_chats()) BLACKLIST_HANDLER = DisableAbleCommandHandler("blacklist", blacklist, pass_args=True, admin_ok=True) ADD_BLACKLIST_HANDLER = CommandHandler("addblacklist", add_blacklist) UNBLACKLIST_HANDLER = CommandHandler(["unblacklist", "rmblacklist"], unblacklist) BLACKLIST_DEL_HANDLER = MessageHandler( (Filters.text | Filters.command | Filters.sticker | Filters.photo) & Filters.group, del_blacklist, edited_updates=True) dispatcher.add_handler(BLACKLIST_HANDLER) dispatcher.add_handler(ADD_BLACKLIST_HANDLER) dispatcher.add_handler(UNBLACKLIST_HANDLER) dispatcher.add_handler(BLACKLIST_DEL_HANDLER, group=BLACKLIST_GROUP)
A multiword filter could be set via: `/filter "hello friend" Hello back! Long time no see!` If you want to save an image, gif, or sticker, or any other data, do the following: `/filter word while replying to a sticker or whatever data you'd like. Now, every time someone mentions "word", that sticker will be sent as a reply.` Now, anyone saying "hello" will be replied to with "Hello there! How are you?". """ __mod_name__ = "Filters" FILTER_HANDLER = DisableAbleCommandHandler("filter", filters) STOP_HANDLER = DisableAbleCommandHandler("stop", stop_filter) STOPALL_HANDLER = DisableAbleCommandHandler("stopall", stop_all_filters) LIST_HANDLER = DisableAbleCommandHandler("filters", list_handlers, admin_ok=True) CUST_FILTER_HANDLER = MessageHandler(CustomFilters.has_text, reply_filter) dispatcher.add_handler(FILTER_HANDLER) dispatcher.add_handler(STOP_HANDLER)
res = bot.restrict_chat_member(chat.id, user_id, can_send_messages=False) if res: update.effective_message.reply_text("No problem, Muted!") log = "<b>{}:</b>" \ "\n#MUTEME" \ "\n<b>User:</b> {}" \ "\n<b>ID:</b> <code>{}</code>".format(html.escape(chat.title), mention_html(user.id, user.first_name), user_id) return log else: update.effective_message.reply_text("Huh? I can't :/") MUTE_HANDLER = DisableAbleCommandHandler("mute", mute, pass_args=True, admin_ok=True) UNMUTE_HANDLER = DisableAbleCommandHandler("unmute", unmute, pass_args=True, admin_ok=True) TEMPMUTE_HANDLER = DisableAbleCommandHandler(["tmute", "tempmute"], temp_mute, pass_args=True, admin_ok=True) TEMP_NOMEDIA_HANDLER = DisableAbleCommandHandler(["trestrict", "temprestrict"], temp_nomedia, pass_args=True, admin_ok=True) NOMEDIA_HANDLER = DisableAbleCommandHandler(["restrict", "nomedia"], nomedia,
An example of how to save a note would be via: /save data This is some data! Now, anyone using "/get data", or "#data" will be replied to with "This is some data!". If you want to save an image, gif, or sticker, or any other data, do the following: /save word while replying to a sticker or whatever data you'd like. Now, the note at "#word" contains a sticker which will be sent as a reply. Tip: to retrieve a note without the formatting, use /get <notename> noformat This will retrieve the note and send it without formatting it; getting you the raw markdown, allowing you to make easy edits Note: Note names are case-insensitive, and they are automatically converted to lowercase before getting saved. """ __mod_name__ = "Notes" GET_HANDLER = DisableAbleCommandHandler("get", cmd_get, pass_args=True) HASH_GET_HANDLER = RegexHandler(r"^#[^\s]+", hash_get) SAVE_HANDLER = DisableAbleCommandHandler("save", save) DELETE_HANDLER = DisableAbleCommandHandler("clear", clear, pass_args=True) LIST_HANDLER = DisableAbleCommandHandler(["notes", "saved"], list_notes, admin_ok=True) dispatcher.add_handler(GET_HANDLER) dispatcher.add_handler(SAVE_HANDLER) dispatcher.add_handler(LIST_HANDLER) dispatcher.add_handler(DELETE_HANDLER) dispatcher.add_handler(HASH_GET_HANDLER)
- /warn <userhandle>: warn a user. After 3 warns, the user will be banned from the group. Can also be used as a reply. - /resetwarn <userhandle>: reset the warnings for a user. Can also be used as a reply. - /addwarn <keyword> <reply message>: set a warning filter on a certain keyword. If you want your keyword to \ be a sentence, encompass it with quotes, as such: `/addwarn "very angry" This is an angry user`. - /nowarn <keyword>: stop a warning filter - /warnlimit <num>: set the warning limit - /strongwarn <on/yes/off/no>: If set to on, exceeding the warn limit will result in a ban. Else, will just kick. - /rmwarn <userhandle>: removes latest warn for a user. It also can be used as reply. - /unwarn <userhandle>: same as /rmwarn """ __mod_name__ = "Warnings" WARN_HANDLER = DisableAbleCommandHandler("warn", warn_user, pass_args=True, filters=Filters.group, admin_ok=True) RESET_WARN_HANDLER = DisableAbleCommandHandler(["resetwarn", "resetwarns"], reset_warns, pass_args=True, filters=Filters.group, admin_ok=True) CALLBACK_QUERY_HANDLER = CallbackQueryHandler(button, pattern=r"rm_warn") MYWARNS_HANDLER = DisableAbleCommandHandler("warns", warns, pass_args=True, filters=Filters.group, admin_ok=True) ADD_WARN_HANDLER = DisableAbleCommandHandler("addwarn", add_warn_filter,
parse_mode=ParseMode.MARKDOWN) 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. """ __mod_name__ = "Stickers" STICKERID_HANDLER = DisableAbleCommandHandler("stickerid", stickerid) GETSTICKER_HANDLER = DisableAbleCommandHandler("getsticker", getsticker) KANG_HANDLER = DisableAbleCommandHandler("kang", kang, pass_args=True, admin_ok=True) dispatcher.add_handler(STICKERID_HANDLER) dispatcher.add_handler(GETSTICKER_HANDLER) dispatcher.add_handler(KANG_HANDLER)
chatname = chat.title res = build_lock_message(chat, chat, user, chatname) update.effective_message.reply_text(res, parse_mode=ParseMode.MARKDOWN) def __migrate__(old_chat_id, new_chat_id): sql.migrate_chat(old_chat_id, new_chat_id) def __chat_settings__(bot, update, chat, chatP, user): chatname = tld(chatP.id, "this chat") return build_lock_message(chat, chatP, user, chatname) 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)
@run_async def shout(bot: Bot, update: Update, args: List[str]): message = update.effective_message chat = update.effective_chat if message.reply_to_message: data = message.reply_to_message.text elif args: data = " ".join(args) else: data = tld(chat.id, "memes_no_message") msg = "```" result = [] result.append(' '.join([s for s in data])) for pos, symbol in enumerate(data[1:]): result.append(symbol + ' ' + ' ' * pos + symbol) result = list("\n".join(result)) result[0] = data[0] result = "".join(result) msg = "```\n" + result + "```" return update.effective_message.reply_text(msg, parse_mode="MARKDOWN") __help__ = True SHOUT_HANDLER = DisableAbleCommandHandler("shout", shout, pass_args=True) dispatcher.add_handler(SHOUT_HANDLER)