Ask coding questions

← Back to all posts
Delete all discord messages
JoeIsHere (0)

So i wan't to do a simple command %DeleteAll to delete all messages in the text channel.

Comments
hotnewtop
SixBeeps (5221)

Something like this should work:

deleted = await channel.purge(check=true)
await channel.send('Deleted {} message(s)'.format(len(deleted)))

EDIT: Doing some research, it may not be possible to delete all messages at once, due to that being heavy on Discord's end. If you really want to delete every single message, you could just delete the channel entirely and create a new one.