from aiogram import types, Dispatcher import json import string async def reaction(message: types.Message): if {i.lower().translate(str.maketrans("", "", string.punctuation)) for i in message.text.split(" ")} \ .intersection(set(json.load(open("censorship.json")))): await message.reply(f"\U0001F92CМаты запрещены!!!\U0001F621\U0001F621\U0001F621") await message.delete() def register_handlers_other(dp: Dispatcher): dp.register_message_handler(reaction)