BuildcordDocs

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

SettingWhat it does
ChannelThe channel to clear.
Look through the lastHow many recent messages to consider, up to 100.
Only fromOnly this member's messages.
Only containingOnly messages with this text in them, ignoring capitals.
Only bots' messagesOnly messages bots sent.
Only messages with filesOnly messages with attachments.
Keep pinned messagesLeave pinned messages alone.
Audit log reasonThe 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}.

On this page