def _message(func): try: if can_disable: self._dispatcher.add_handler( DisableAbleMessageHandler(pattern, func, friendly=friendly, run_async=run_async), group, ) else: self._dispatcher.add_handler( MessageHandler(pattern, func, run_async=run_async), group) LOGGER.debug( f"[KAIMSG] Loaded filter pattern {pattern} for function {func.__name__} in group {group}" ) except TypeError: if can_disable: self._dispatcher.add_handler( DisableAbleMessageHandler(pattern, func, friendly=friendly, run_async=run_async)) else: self._dispatcher.add_handler( MessageHandler(pattern, func, run_async=run_async)) LOGGER.debug( f"[KAIMSG] Loaded filter pattern {pattern} for function {func.__name__}" ) return func
if int(userc_id) == int(user_id): return res = "{} is afk.\nReason: <code>{}</code>".format( 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)]
if args == "None": message.reply_text("Nyah boi request something!!") return "" if chat and chat.type == Chat.SUPERGROUP: requested = "Nyahh!! Request accepted!!" msg = f"<b>{html.escape(chat.title)}</b>\n<b>Requested: </b> {args}\n<b>Requesting User:</b> {mention_html(req_user.id, req_user.first_name)}" if chat.username: link = f'\n<b> </b> <a href="https://t.me/{chat.username}/{message.message_id}">.......</a>' else: link = " " if sql.get_chat_req_channel(chat.id): bot.send_message(sql.get_chat_req_channel(chat.id), msg + link, parse_mode = ParseMode.HTML) else: bot.send_message(chat.id, "Req Channel Not set!" ) message.reply_text("Nyah! Request Accepted!!") return msg return "" REQU_HANDLER = DisableAbleCommandHandler ("request", req) REQ_HANDLER = DisableAbleMessageHandler(Filters.regex(r"^#[^\s]+"), req, friendly="request") SET_HANDLER = DisableAbleCommandHandler("setreq", setreq) dispatcher.add_handler(REQU_HANDLER, NOTIF_GROUP) dispatcher.add_handler(SET_HANDLER) dispatcher.add_handler(REQ_HANDLER, NOTIF_GROUP)
update.effective_message.reply_text( "The result of the sed command was too long for \ telegram!", ) elif text: update.effective_message.reply_to_message.reply_text(text) __help__ = """ • `s/<text1>/<text2>(/<flag>)`*:* Reply to a message with this to perform a sed operation on that message, replacing all \ occurrences of 'text1' with 'text2'. Flags are optional, and currently include 'i' for ignore case, 'g' for global, \ or nothing. Delimiters include `/`, `_`, `|`, and `:`. Text grouping is supported. The resulting message cannot be \ larger than {}. *Reminder:* Sed uses some special characters to make matching easier, such as these: `+*.?\\` If you want to use these characters, make sure you escape them! *Example:* \\?. """.format( telegram.MAX_MESSAGE_LENGTH, ) __mod_name__ = "Sed/Regex" SED_HANDLER = DisableAbleMessageHandler( Filters.regex(r"s([{}]).*?\1.*".format("".join(DELIMITERS))), sed, friendly="sed", run_async=True, ) dispatcher.add_handler(SED_HANDLER)
➩ /blue <text>: bluify your text! ➩ /latin <text>: latinify your text! ➩ /lined <text>: lined your text! *Regex based memes:* ➩ `/decide` can be also used with regex like: `Elizabeth What? <question>: randomly answer "Yes, No" etc.` Some other regex filters are: `me too` | `good morning` | `good night`. Elizabeth will reply random strings accordingly when these words are used! All regex filters can be disabled incase u don't want... like: `/disable metoo`. """ __mod_name__ = "MEMES" SHRUG_HANDLER = DisableAbleCommandHandler("shrug", shrug) DECIDE_HANDLER = DisableAbleMessageHandler( Filters.regex(r"(?i)(Elizabeth)"), decide, friendly="decide" ) SNIPE_HANDLER = CommandHandler( "snipe", snipe, pass_args=True, filters=CustomFilters.sudo_filter ) ABUSE_HANDLER = DisableAbleCommandHandler("abuse", abuse) POLICE_HANDLER = DisableAbleCommandHandler("police", police) RUNS_HANDLER = DisableAbleCommandHandler("runs", runs) SLAP_HANDLER = DisableAbleCommandHandler("slap", slap, pass_args=True) PUNCH_HANDLER = DisableAbleCommandHandler("punch", punch, pass_args=True) HUG_HANDLER = DisableAbleCommandHandler("warm", hug, pass_args=True) GBUN_HANDLER = CommandHandler("gbun", gbun) TABLE_HANDLER = DisableAbleCommandHandler("table", table) CRI_HANDLER = DisableAbleCommandHandler("cri", cri) PASTA_HANDLER = DisableAbleCommandHandler("pasta", copypasta) CLAP_HANDLER = DisableAbleCommandHandler("clap", clapmoji)
Suzuya will reply random strings accordingly when these words are used! All regex filters can be disabled incase u don't want... like: `/disable goodnight`. """ __mod_name__ = "Memes" PAT_HANDLER = DisableAbleCommandHandler("pat", pat) SHOUT_HANDLER = DisableAbleCommandHandler("shout", shout) DARE_HANDLER = DisableAbleCommandHandler("dare", dare) TRUTH_HANDLER = DisableAbleCommandHandler("truth", truth) SANITIZE_HANDLER = DisableAbleCommandHandler("sanitize", sanitize) SHRUG_HANDLER = DisableAbleCommandHandler("shrug", shrug) DECIDE_HANDLER = DisableAbleMessageHandler(Filters.regex(r"(?i)^Suzuya\?"), decide, friendly="decide") ABUSE_HANDLER = DisableAbleCommandHandler("abuse", abuse, pass_args=True) RUNS_HANDLER = DisableAbleCommandHandler("runs", runs, pass_args=True) SLAP_HANDLER = DisableAbleCommandHandler("slap", slap) HUG_HANDLER = DisableAbleCommandHandler("hug", hug) GBUN_HANDLER = CommandHandler("gbun", gbun) GBAM_HANDLER = CommandHandler("gbam", gbam) TABLE_HANDLER = DisableAbleCommandHandler("table", table) CRI_HANDLER = DisableAbleCommandHandler("cri", cri) PASTA_HANDLER = DisableAbleCommandHandler("pasta", copypasta) 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)
# empty string errors -_- if len(text) >= telegram.MAX_MESSAGE_LENGTH: update.effective_message.reply_text( "The result of the sed command was too long for \ telegram!") elif text: update.effective_message.reply_to_message.reply_text(text) __help__ = """ • `s/<text1>/<text2>(/<flag>)`*:* Reply to a message with this to perform a sed operation on that message, replacing all \ occurrences of 'text1' with 'text2'. Flags are optional, and currently include 'i' for ignore case, 'g' for global, \ or nothing. Delimiters include `/`, `_`, `|`, and `:`. Text grouping is supported. The resulting message cannot be \ larger than {}. *Reminder:* Sed uses some special characters to make matching easier, such as these: `+*.?\\` If you want to use these characters, make sure you escape them! *Example:* \\?. """.format(telegram.MAX_MESSAGE_LENGTH) __mod_name__ = "Sed/Regex" SED_HANDLER = DisableAbleMessageHandler(Filters.regex(r's([{}]).*?\1.*'.format( "".join(DELIMITERS))), sed, friendly="sed") dispatcher.add_handler(SED_HANDLER) __command_list__ = ["s"] __handlers__ = [SED_HANDLER]
*Some dank memes for fun or whatever! ✪ `/slap`: Slap a user, or get slapped if not a reply. ✪ `/hug`: Hug a user warmly, or get hugged if not a reply. ✪ `/roll`: Rolls a dice. ✪ `/clap`: Claps on someones message! """ __mod_name__ = "Memes😊" SLAP_HANDLER = DisableAbleCommandHandler("slap", slap) HUG_HANDLER = DisableAbleCommandHandler("hug", hug) DICE_HANDLER = DisableAbleCommandHandler("roll", dice) CLAP_HANDLER = DisableAbleCommandHandler("clap", clapmoji) GDMORNING_HANDLER = DisableAbleMessageHandler( Filters.regex(r"(?i)(gm|good morning)"), goodmorning, friendly="goodmorning") GDNIGHT_HANDLER = DisableAbleMessageHandler( Filters.regex(r"(?i)(gn|good night)"), goodnight, friendly="goodnight") dispatcher.add_handler(SLAP_HANDLER) dispatcher.add_handler(HUG_HANDLER) dispatcher.add_handler(DICE_HANDLER) dispatcher.add_handler(CLAP_HANDLER) dispatcher.add_handler(GDMORNING_HANDLER) dispatcher.add_handler(GDNIGHT_HANDLER) #this line should not be removed! or else a opt will be created !! Taken from saitaima and preven's repo and contributed here! those things which are not given here are either #tested not working or logs error in this repo !