Purge messages
Bulk-delete recent messages in a channel, all of them or only some.
server.purge deletes many recent messages from a channel at once, optionally only those that match filters.
Settings
| Setting | What it does |
|---|---|
| Channel | The channel to clear. |
| Look through the last | How many recent messages to consider, up to 100. |
| Only from | Only this member's messages. |
| Only containing | Only messages with this text in them, ignoring capitals. |
| Only bots' messages | Only messages bots sent. |
| Only messages with files | Only messages with attachments. |
| Keep pinned messages | Leave pinned messages alone. |
| Audit log reason | The reason Discord records. |
Ways out
out. Turn on If it fails for a red way out.
Produces
{purged.count}: how many messages were deleted.
Notes
- Discord doesn't allow bulk-deleting messages older than two weeks, so those are always left.
- The filters narrow what's deleted among the messages looked through: purging 50 from one member looks through the last 50 messages and deletes theirs.
- The bot needs the Manage Messages and Read Message History permissions.
- The canvas shows
10 from #general, and says when it's filtered.
Example
A /clean command with a member option: look through the last 100 messages and delete {option.member}'s, then reply with Deleted {purged.count}.