Почему-то не работает, бот включается, но банворды не удаляет
import disnake
from disnake.ext import commands
bot = commands.Bot(command_prefix="*", help_command=None, intents=disnake.Intents.all())
@bot.event
async def on_ready():
print(f"Bot {bot.user} is ready to work!")
with open('bun_words.txt', 'r', encoding='utf8') as file:
kek = file.read()
@bot.event
async def on_message(message):
for content in message.content.split():
for censored_word in kek:
if content == censored_word:
await message.delete()
await message.channel.send(f"{message.author.mention} такие слова запрещены!")
@bot.event
async def on_commands_error(ctx, error):
print(error)
bot.run()
Источник: Stack Overflow на русском