Deleting User Messages in Discord.py

Yup, it should be possible.

You need the bot/user account to have the Manage Messages permission.

@client.event
async def on_message(message):
    await message.delete()

So, the event would occur something like

User sends message
Bot detects that the user has sent a message
Bot deletes the message that the user sent

Hopefully from this you should be able to see how user messages are deleted, just ensure that the bot/user account as the Manage Messages permission.

Leave a Comment