def stop_all_filters(bot: Bot, update: Update): chat = update.effective_chat user = update.effective_user message = update.effective_message if chat.type == "private": chat.title = "local filters" else: owner = chat.get_member(user.id) chat.title = chat.title if owner.status != 'creator': message.reply_text("You must be this chat creator.") return x = 0 flist = sql.get_chat_triggers(chat.id) if not flist: message.reply_text("There aren't any active filters in {} !".format( chat.title)) return f_flist = [] for f in flist: x += 1 f_flist.append(f) for fx in f_flist: sql.remove_filter(chat.id, fx) message.reply_text( "{} filters from this chat have been removed.".format(x))
def stop_filter(bot: Bot, update: Update): chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] args = update.effective_message.text.split(None, 1) conn = connected(bot, update, chat, user.id) if not conn == False: chat_id = conn chat_name = dispatcher.bot.getChat(conn).title else: chat_id = chat.id if chat.type == "private": chat_name = "local notes" else: chat_name = chat.title if len(args) < 2: return chat_filters = sql.get_chat_triggers(chat_id) if not chat_filters: update.effective_message.reply_text("No filters are active here!") return for keyword in chat_filters: if keyword == args[1]: sql.remove_filter(chat_id, args[1]) update.effective_message.reply_text( "_Filter Deleted Successfully_ *{}*.".format(chat_name), parse_mode=telegram.ParseMode.MARKDOWN) raise DispatcherHandlerStop update.effective_message.reply_text( "Your Filter Keyword is Incorrect please check Your Keyword /filters")
def stop_all_filters(bot: Bot, update: Update): chat = update.effective_chat user = update.effective_user message = update.effective_message if chat.type == "private": chat.title = "local filters" else: owner = chat.get_member(user.id) chat.title = chat.title if owner.status != 'creator': message.reply_text("ʏᴏᴜ ᴍᴜsᴛ ʙᴇ ᴛʜɪs ᴄʜᴀᴛ's ᴄʀᴇᴀᴛᴏʀ.") return x = 0 flist = sql.get_chat_triggers(chat.id) if not flist: message.reply_text("ᴛʜᴇʀᴇ ᴀʀᴇɴ'ᴛ ᴀɴʏ ᴀᴄᴛɪᴠᴇ ғɪʟᴛᴇʀs ɪɴ {} !".format( chat.title)) return f_flist = [] for f in flist: x += 1 f_flist.append(f) for fx in f_flist: sql.remove_filter(chat.id, fx) message.reply_text( "{} ғɪʟᴛᴇʀs ғʀᴏᴍ ᴛʜɪs ᴄʜᴀᴛ ʜᴀᴠᴇ ʙᴇᴇɴ ʀᴇᴍᴏᴠᴇᴅ.".format(x))
def stop_filter(bot: Bot, update: Update): chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] args = update.effective_message.text.split(None, 1) conn = connected(bot, update, chat, user.id) if not conn == False: chat_id = conn chat_name = dispatcher.bot.getChat(conn).title else: chat_id = chat.id if chat.type == "private": chat_name = "local notes" else: chat_name = chat.title if len(args) < 2: return chat_filters = sql.get_chat_triggers(chat_id) if not chat_filters: update.effective_message.reply_text("ɴᴏ ᴀᴄᴛɪᴠᴇ ғɪʟᴛᴇʀs ᴀʀᴇ ʜᴇʀᴇ!") return for keyword in chat_filters: if keyword == args[1]: sql.remove_filter(chat_id, args[1]) update.effective_message.reply_text( "ғɪʟᴛᴇʀ ᴅᴇʟᴇᴛᴇᴅ sᴜᴄᴄᴇssғᴜʟʟʏ ғʀᴏᴍ *{}*.".format(chat_name), parse_mode=telegram.ParseMode.MARKDOWN) raise DispatcherHandlerStop update.effective_message.reply_text( "ʏᴏᴜʀ ғɪʟᴛᴇʀ ᴋᴇʏᴡᴏʀᴅ ɪs ɪɴᴄᴏʀʀᴇᴄᴛ ᴘʟᴇᴀsᴇ ᴄʜᴇᴄᴋ ʏᴏᴜʀ ᴋᴇʏᴡᴏʀᴅ /filters")
def stop_filter(bot: Bot, update: Update): chat = update.effective_chat msg = update.effective_message args = msg.text.split(None, 1) if len(args) < 2: return chat_filters = sql.get_chat_triggers(chat.id) if not chat_filters: msg.reply_text("No filters are active here!") return for keyword in chat_filters: if keyword == args[1]: sql.remove_filter(chat.id, args[1]) msg.reply_text("Yep, I'll stop replying to that.") raise DispatcherHandlerStop msg.reply_text("That's not a current filter - run /filters for all active filters.")