Auto Purge: Automatically Delete Old Messages
How Kage's Auto Purge regularly deletes old messages in channels: rules, filters, schedule, limits per run, permissions and troubleshooting.
Last checked for accuracy: 14 October 2026
Auto Purge regularly deletes old messages in channels you choose, for example in a channel for requests, bot commands or time-limited announcements. For each channel you create a rule: how old a message has to be, which messages are affected, and how often Kage cleans up.
Deleted messages are gone for good. Therefore test every new rule in an unimportant channel first. For a short walkthrough, see the guide Setting up Auto Purge. For one-off deletion by command, there is /mod purge in Moderation.
Requirements
- Access to the module: You sign in to the dashboard with Discord and need the Manage Server permission (or access granted for this module).
- Kage's permissions in the channel: Manage Messages and Read Message History.
- Plan: The plan notice at the top of this page shows which plan the module needs. If the plan lapses, Kage pauses the module until it applies again. The upper limit for rules is under "Settings at a glance".
- Text channel: Auto Purge works only in text channels.
How Auto Purge works
Kage checks every 5 minutes which rules are due.
- A rule is due if it has never run or the schedule has passed since the last run: hourly = 1 hour, daily = 24 hours, weekly = 168 hours. A new rule therefore runs for the first time on the next check.
- Kage searches the channel for messages older than the configured value ("Older than (hours)", 168 hours = 7 days if empty), starting with the oldest.
- Kage never deletes pinned messages.
- Kage applies the filter to the rest (see below).
- Per run and rule, Kage deletes at most 300 messages. If there are more, the rest follows on the next due run.
- Messages under 14 days old are deleted in bulk, older ones one by one with a short pause, to respect Discord's rate limits. That takes longer with many old messages.
- If messages were deleted, an entry appears in the module's Logs tab ("N messages deleted in #channel").
The filters
| Filter in the dashboard | Affects |
|---|---|
| all messages | every message that is not pinned |
| bot messages | messages from bots |
| human messages | messages from non-bots |
| messages with links | text contains http:// or https:// |
| messages with a keyword | text contains the keyword (case-insensitive) |
| messages from a user | messages from the person with the given user ID |
For the *keyword* and *user* filters you must enter a value, otherwise the dashboard refuses to save. The keyword is searched as part of the text, not as a whole word.
Settings at a glance
| Dashboard field | Meaning | Default |
|---|---|---|
| Auto Purge enabled | Turns the module on | off |
| Channel | The rule's channel | – |
| Older than (hours) | Minimum age of the messages, 1 to 8,760 hours (365 days) | 168 |
| Schedule | hourly, daily or weekly | daily |
| Filter | see table above | all messages |
| Keyword / user ID | Value for the corresponding filters | – |
Premium allows up to 25 rules, Enterprise up to 100. Existing rules above the limit are not trimmed; only further growth is blocked. Auto Purge has no slash commands.
Checking the result
- Test rule: In a test channel, create a rule with a small age (for example 1 hour) and the filter *all messages*.
- Wait: After the next check (within 5 minutes at the latest), messages older than an hour should be gone; pinned ones stay.
- Logs tab: The entry names the number of deleted messages.
Troubleshooting
Nothing is deleted
Check that "Auto Purge enabled" is on, the rule is saved and the channel is a text channel. Check that the plan applies. Check Kage's permissions in the channel (Manage Messages, Read Message History). Without access, Kage skips the channel and only writes to the operating log. Also check whether there are any messages older than "Older than (hours)" that match the filter.
Only part is deleted
Per run, Kage deletes at most 300 messages. In a very full channel it takes several runs.
A new rule deletes immediately
That is intended: a rule without a previous run is due on the next check. Set the age correctly before saving.
Important messages were deleted
Only pinned messages are spared. Deleted messages cannot be restored. Check age and filter before every activation, and pin important messages before the rule runs.
Further reading
One-off deletion by command: /mod purge in Moderation. Log of general server activity: Audit log.
Related Kage modules
- Auto CleanupFrom Premium
- ModerationIncluded in Basic
Keep reading
More questions? Ask Kage AIAI
Describe what you need – Kage AI picks out the right guide and gives you the sources.
Try Kage on your server
Sign in with Discord, invite the bot and set up the modules in the dashboard. The Basic plan is free forever.