def set_blue_text_must_click(update: Update, context: CallbackContext): chat = update.effective_chat message = update.effective_message bot, args = context.bot, context.args if len(args) >= 1: val = args[0].lower() if val in ("off", "no"): sql.set_cleanbt(chat.id, False) reply = "Bluetext cleaning has been disabled for <b>{}</b>".format( html.escape(chat.title)) message.reply_text(reply, parse_mode=ParseMode.HTML) elif val in ("yes", "on"): sql.set_cleanbt(chat.id, True) reply = "Bluetext cleaning has been enabled for <b>{}</b>".format( html.escape(chat.title)) message.reply_text(reply, parse_mode=ParseMode.HTML) else: reply = "Invalid argument.Accepted values are 'yes', 'on', 'no', 'off'" message.reply_text(reply) else: clean_status = sql.is_enabled(chat.id) clean_status = "Enabled" if clean_status else "Disabled" reply = "Bluetext cleaning for <b>{}</b> : <b>{}</b>".format( html.escape(chat.title), clean_status) message.reply_text(reply, parse_mode=ParseMode.HTML)
def clean_blue_text_must_click(update: Update, context: CallbackContext): bot = context.bot chat = update.effective_chat message = update.effective_message if chat.get_member(bot.id).can_delete_messages and sql.is_enabled(chat.id): fst_word = message.text.strip().split(None, 1)[0] if len(fst_word) > 1 and any( fst_word.startswith(start) for start in CMD_STARTERS): command = fst_word[1:].split("@") chat = update.effective_chat ignored = sql.is_command_ignored(chat.id, command[0]) if ignored: return if command[0] not in command_list: message.delete()