def rmall_filters(update, context): chat = update.effective_chat user = update.effective_user msg = update.effective_message usermem = chat.get_member(user.id) if not usermem.status == "creator": msg.reply_text("This command can be only used by chat OWNER!") return allfilters = sql.get_chat_triggers(chat.id) if not allfilters: msg.reply_text("No filters in this chat, nothing to stop!") return count = 0 filterlist = [] for x in allfilters: count += 1 filterlist.append(x) for i in filterlist: sql.remove_filter(chat.id, i) return msg.reply_text(f"Cleaned {count} filters in {chat.title}")
def stop_filter(update, context): chat = update.effective_chat user = update.effective_user args = update.effective_message.text.split(None, 1) conn = connected(context.bot, update, chat, user.id) if not conn == False: chat_id = conn chat_name = dispatcher.bot.getChat(conn).title else: chat_id = update.effective_chat.id if chat.type == "private": chat_name = "Local filters" else: chat_name = chat.title if len(args) < 2: send_message(update.effective_message, "What should i stop?") return chat_filters = sql.get_chat_triggers(chat_id) if not chat_filters: send_message(update.effective_message, "No filters active here!") return for keyword in chat_filters: if keyword == args[1]: sql.remove_filter(chat_id, args[1]) send_message( update.effective_message, "Okay, I'll stop replying to that filter in *{}*.".format( chat_name), parse_mode=telegram.ParseMode.MARKDOWN, ) raise DispatcherHandlerStop send_message( update.effective_message, "That's not a filter - Click: /filters to get currently active filters.", )