'Unable to use any other commands after making event to delete messages within a channel Discord.py

I made a simple event to delete all messages with attachments within a channel and now commands within my bot are not working as intended

the event

@client.event
async def on_message(message):
 if message.attachments and message.channel.id == 957450518463119400:
  await message.delete()
 if not message.attachments and message.channel.id == 957450518463119400:
  await message.send()

an example of a command that isn't working (not sending the "stop" message)

@client.command()
async def damndaniel(ctx: commands.Context):
    await ctx.send(f"stop")

there aren't any errors in terminal. as soon as I remove the event the example command is working fine

ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ



Solution 1:[1]

If you override the on_message() event, you need to add client.process_commands() to your event manually so it should be like this:

@client.event
async def on_message(message):
 if message.attachments and message.channel.id == 957450518463119400:
  await message.delete()

 if not message.attachments and message.channel.id == 957450518463119400:
  await message.send()
 
 await client.process_commands(message)

Reference

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 3nws