words_to_filter = ["badword1", "badword2", "badword3"]
@bot.event
async def on_message(message):
print(f"on_message event triggered") # Add this line
if message.author == bot.user:
return
for word in words_to_filter:
if word in message.content:
print(f"Bad word found: {word}") # check on_message event
await message.delete() #message delete
await message.channel.send(f"{message.author.mention}, դուք օգտագործել եք արգելված բառ ձեր հաղրոդագրությունում") # after deleting message send message
return
else:
print('Falseee') # if script not working print 'Falseee'
return
await bot.process_commands(message)
terminal output:

I tried several options to check if all events are working
the function of the code is to remove bad words in the message after running the code, when I send any word in the text channel, the on_message event works, but the function itself is not executed
The return in for is not needed and letting your code exit once it check the first word in your list as its going into else block