Skip to content
Sign upLog in
← Back to Community

Delete all discord messages

Profile icon
JoeIsHere

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

Voters
Profile icon
yin285827
Profile icon
ANGELICAGRACEGR
Profile icon
KelvinCousins
Profile icon
JoeIsHere
Comments
hotnewtop
Profile icon
Coder100

what language?

Profile icon
JoeIsHere

@Coder100
Im using python

Profile icon
Coder100

cool

@JoeIsHere

Profile icon
Coder100

https://stackoverflow.com/questions/43465082/python-discord-py-delete-all-messages-in-a-text-channel
this should work

@JoeIsHere

Profile icon
SixBeeps

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.