Discord Purge Bot: Bulk Delete Messages with Filters
A Discord purge bot deletes many messages in one command instead of one click at a time. Noxyr's /clear looks at the last 1 to 100 messages in a channel and removes all of them, or only those from one member, from bots, or with links, images or embeds.
Why use a bot to clear messages
After a spam wave, a raid or a heated argument, deleting messages by hand is slow and you tend to miss some. Discord lets moderators delete a message at a time, and it has a bulk delete tool for bots. A purge bot uses that tool so a channel can be cleaned in a few seconds.
The useful part is not the speed, it is the filter. Wiping a channel also wipes the staff replies and the useful posts around the spam. Filtering by member, by bots or by links lets you take out only what you meant to.
How /clear works
Run /clear amount:25 in a channel and Noxyr removes the last 25 messages there. The amount is required and can be 1 to 100. Add a filter and the bot looks at that many recent messages and deletes the ones that match. That detail matters: amount:50 bots:true means "check the last 50 messages and delete the bot ones", not "delete 50 bot messages".
| Option | What it deletes |
|---|---|
amount | Required, 1 to 100. How many recent messages to look at. |
user | Only messages from this member. |
bots | Only messages sent by bots. |
embeds | Only messages that contain an embed. |
link | Only messages containing a link. |
images | Only messages with an image attachment. |
Common clean-up jobs
A spammer posted in a busy channel
Use the user filter with a high amount, such as 100. Only that member's messages go, and the conversation around them stays. Then deal with the account itself: a timeout or a warning, covered below.
Bot commands cluttering a chat channel
Turn on the bots filter. Music bots and game bots leave long trails of embeds, and this clears them without touching what people typed.
A link-spam or scam wave
Use the link filter. If the scam used images or an embed card, run it again with images or embeds. Each run takes one filter, so a few quick commands cover it.
A channel that needs a full reset
Run /clear with just the amount, at 100, as many times as needed. For routine resets, a timer is better than a manual command: see the cleanup schedule in the scheduled messages bot page.
The 14-day limit
Discord's bulk delete only accepts messages younger than 14 days. Noxyr filters older ones out silently instead of failing the whole command. So when the bot answers that no messages matched your filters, it can mean the matching messages are simply too old. Those have to be deleted one by one inside Discord.
There is no undo. Deleted messages are gone for good, so use the user filter when you only want one person's posts removed and check the channel before running a large clear.
Permissions
/clear is admin-only on the bot side. The bot itself also needs the Manage Messages permission in the channel. If a channel permission override denies Manage Messages to the Noxyr role, the command fails even when an admin runs it. Check the override on the channel and on its category.
If you want other moderators to keep order without full admin rights, give them the warnings tools instead and keep the purge for admins.
Prevent the mess in the first place
Purging cleans up after the fact. Three Noxyr modules reduce how often you need it:
- Anti-spam times out accounts that flood messages, mentions or links.
- Link filters remove unwanted links as they are posted.
- Server logs log a purge as one entry with how many messages were removed, and individual deleted messages with who wrote them.
Together they are the core of the security bot setup.
A safe way to run a purge
- Look first. Scroll the channel and note what you want gone and what must stay, such as a pinned rule post or a staff reply.
- Start narrow. Use a filter and a small amount. Check the result, then repeat with a bigger amount if you need to.
- Check the log. If you have a log channel, confirm the purge appears there with the number of messages removed.
- Deal with the cause. A purge is cleanup. Timeout the account, tighten the link filter or lock the channel for a while, so the same mess does not come back an hour later.
Moderators on a team often agree on one rule: nobody runs a purge above 50 messages without telling the others in the staff channel. Because there is no undo, a short heads-up costs nothing.
Next steps
The clear messages docs list every option and error message. Add Noxyr to try it; the command and the modules above are free.
Common questions
How many messages can /clear delete at once?
Up to 100 recent messages per command. You can run it again for more.
Can I delete only one member's messages?
Yes. Add the user filter with the member and Noxyr deletes only their messages among the last ones it checks.
Why does /clear say no messages were found?
The matching messages may be older than 14 days. Discord does not allow bulk deletion of those, so they must be removed one by one.
Can I undo a purge?
No. Deleted messages are gone, so check your filters before you run it.
What permissions does the bot need?
Manage Messages in the channel. The command itself is admin-only on the bot side.