Подскажите, как исправить фильтр мата, не удаляются плохие слова.
Все варианты, что нашел в нете и перепробовал:
import aiogram
import logging
import math
import time
from aiogram import Bot, Dispatcher, executor, types
from aiogram.dispatcher.filters import BoundFilter
from aiogram.utils import executor
from contextlib import suppress
from aiogram.utils.exceptions import (MessageToEditNotFound, MessageCantBeEdited, MessageCantBeDeleted,
MessageToDeleteNotFound)
bad_word = ["Мат", "мат2", "мат3"]
@dp.message_handler(lambda message: message.text and message.text.lower() in bad_word and message.chat.id)
async def filter(message):
await message.delete()
@dp.message_handler(lambda message: message.text and message.text.lower() in bad_word and message.chat.id)
async def filter(message):
await bot.delete_message(message.chat.id, message.message_id)
@dp.message_handler()
async def filter(message):
if any([i for i in bad_word if i in message.text.lower()]):
await message.delete()
ban()
@dp.message_handler()
async def filter(message: types.Message):
if bad_word in message.text:
await message.delete()
@dp.message_handler()
async def filter(message: types.Message):
for word in bad_word:
if word in message.text:
await message.delete()
break
@dp.message_handler()
async def filter_messages(message: types.Message):
for word in bad_word:
if word in message.content.lower():
await message.delete()
@dp.message_handler()
async def filter(message: types.Message):
if message.text.lower() in bad_word:
await message.delete()
@dp.message_handler()
async def filter(message):
for i in bad_word:
if i in message.content.lower():
await message.delete()
@dp.message_handler()
async def filter(message: types.Message):
for i in bad_word:
if mute in message.text:
await message.delete()
else:
return
@dp.message_handler()
async def on_message(message):
messageContent = message.content
if any(word.lower() in messageContent.lower().replace(' ', '') for word in bad_word):
await message.delete()
@dp.message_handler()
async def filter(message: types.Message):
if any(word in message.text.lower() for word in bad_word):
await message.forward(message.chat.id)
await message.delete()
time.sleep(1)
print(message)
@dp.message_handler()
async def filter(message):
if message.author == bot.user: return # если сообщение от бота - игнорируем
for word in bad_word:
if word in message.content.lower():
try:
await message.delete()
except:
pass
await message.channel.send(f'{message.author.mention}, не ругайся матом')
break