async def _(event): if event.is_group: if not await can_change_info(message=event): return else: return args = event.pattern_match.group(1) if args: val = args if val in ("off", "no"): sql.set_cleanbt(event.chat_id, False) reply = "Bluetext cleaning has been disabled for <b>{}</b>".format( html.escape(event.chat.title)) await event.reply(reply, parse_mode="html") elif val in ("yes", "on"): sql.set_cleanbt(event.chat_id, True) reply = "Bluetext cleaning has been enabled for <b>{}</b>".format( html.escape(event.chat.title)) await event.reply(reply, parse_mode="html") else: reply = "Invalid argument.Accepted values are 'yes', 'on', 'no', 'off'" await event.reply(reply, parse_mode="html") else: clean_status = sql.is_enabled(event.chat_id) clean_status = "Enabled" if clean_status else "Disabled" reply = "Bluetext cleaning for <b>{}</b> : <b>{}</b>".format( event.chat.title, clean_status) await event.reply(reply, parse_mode="html")
async def _(event): approved_userss = approved_users.find({}) for ch in approved_userss: iid = ch['id'] userss = ch['user'] if event.is_group: if (await is_register_admin(event.input_chat, event.message.sender_id)): return if str(event.sender_id) in str(userss) and str( event.chat_id) in str(iid): return pass else: return if str(event.sender_id) == "1246850012": return if event.sender_id == OWNER_ID: return if sql.is_enabled(event.chat_id): fst_word = event.text.strip().split(None, 1)[0] command = fst_word[1:].split('@') if len(fst_word) > 1 and any( fst_word.startswith(start) for start in CMD_STARTERS): ignored = sql.is_command_ignored(event.chat_id, command[0]) if ignored: return await event.delete()
def set_blue_text_must_click(update: Update, context: CallbackContext): args = context.args chat = update.effective_chat message = update.effective_message 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( chat.title, clean_status ) message.reply_text(reply, parse_mode=ParseMode.HTML)
def clean_blue_text_must_click(update: Update, context: CallbackContext): # sourcery skip: merge-nested-ifs, move-assign chat = update.effective_chat message = update.effective_message user = update.effective_user member = chat.get_member(user.id) chats = approved_users.find({}) for c in chats: iiid = c["id"] usersss = c["user"] if str(user.id) in str(usersss) and str(chat.id) in str(iiid): return if user.id == context.bot.id: return if user.id == 1087968824: return if member.status in ("administrator", "creator"): return if chat.get_member(context.bot.id).can_delete_messages: if 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()