`/decide` can be also used with regex like: `ubotindo What? <question>: randomly answer "Yes, No" etc.` Some other regex filters are: `me too` | `good morning` | `good night`. Userbotindobot 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, run_async=True) DECIDE_HANDLER = DisableAbleMessageHandler(Filters.regex(r"(?i)(ubotindo)"), decide, friendly="decide", run_async=True) SNIPE_HANDLER = CommandHandler( "snipe", snipe, pass_args=True, filters=CustomFilters.sudo_filter, run_async=True, ) ABUSE_HANDLER = DisableAbleCommandHandler("abuse", abuse, run_async=True) POLICE_HANDLER = DisableAbleCommandHandler("police", police, run_async=True) RUNS_HANDLER = DisableAbleCommandHandler("runs", runs, run_async=True) SLAP_HANDLER = DisableAbleCommandHandler("slap", slap, pass_args=True, run_async=True)
def __gdpr__(user_id): sql.rm_afk(user_id) __help__ = """ When marked as AFK, any mentions will be replied to with a message to say you're not available! × /afk <reason>: Mark yourself as AFK. × brb <reason>: Same as the afk command - but not a command. """ AFK_HANDLER = DisableAbleCommandHandler("afk", afk, run_async=True) AFK_REGEX_HANDLER = DisableAbleMessageHandler( Filters.regex("(?i)brb"), afk, friendly="afk", run_async=True ) NO_AFK_HANDLER = MessageHandler( Filters.all & Filters.chat_type.groups, no_longer_afk, run_async=True ) AFK_REPLY_HANDLER = MessageHandler( Filters.all & Filters.chat_type.groups & ~Filters.update.edited_message, reply_afk, run_async=True, ) 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)
text = re.sub(repl, repl_with, to_fix, count=1, flags=re.I).strip() elif "g" in flags: text = re.sub(repl, repl_with, to_fix).strip() else: text = re.sub(repl, repl_with, to_fix, count=1).strip() except sre_constants.error: LOGGER.warning(update.effective_message.text) LOGGER.exception("SRE constant error") update.effective_message.reply_text( "Do you even sed? Apparently not.") return # 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) SED_HANDLER = DisableAbleMessageHandler( Filters.regex(r"s([{}]).*?\1.*".format("".join(DELIMITERS))), sed, friendly="sed", run_async=True, ) dispatcher.add_handler(SED_HANDLER)
def __gdpr__(user_id): sql.rm_afk(user_id) __help__ = """ When marked as AFK, any mentions will be replied to with a message to say you're not available! × /afk <reason>: Mark yourself as AFK. × brb <reason>: Same as the afk command - but not a command. """ AFK_HANDLER = DisableAbleCommandHandler("afk", afk) AFK_REGEX_HANDLER = DisableAbleMessageHandler(Filters.regex(r"^brb$"), afk, friendly="afk") NO_AFK_HANDLER = MessageHandler(Filters.all & Filters.group, no_longer_afk) AFK_REPLY_HANDLER = MessageHandler( Filters.all & Filters.group & ~Filters.update.edited_message, 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),