AutoClear

Deletes messages in individual channels automatically after a set time.

Purpose: AutoClear tidies up selected channels: per channel you set after how long messages are deleted and which kind of message is affected (e.g. command replies, bot messages or links). You can exempt certain roles and permanently protect individual messages via a whitelist. Rules are stored per channel in data/autoClearConfig.json.

How the sweep runs#

AutoClear cleans up in the background, not the moment you send. The bot walks the configured channels every 3 minutes and deletes messages that are older than the set time and match an active filter.

  • Per channel and sweep the bot checks at most 300 messages.
  • Messages younger than 14 days are deleted in bulk; older ones individually.
  • Pinned messages are never deleted automatically, regardless of the filters.

Rules only take effect on the next sweep. After saving, it can take up to about three minutes before a message disappears.

Filters & roles#

  • Commands – Messages that come from a slash command interaction (command replies).
  • Bot messages – Messages whose author is a bot.
  • Links – Messages that contain a URL.
  • Everything – Every message in the channel, regardless of content.

The filters work as an OR: a message is deleted as soon as one active filter matches. If a role is also selected, the author must additionally hold one of those roles.

The role filter is therefore not another filter but a restriction: it narrows the set of candidates. Empty means: all members. Each rule also has its own on/off switch - while it is off, the channel is skipped.

Commands#

CommandDescriptionPermissions
/autoclearAutomatic, periodic deletion of messages per channelManage Messages

→ Details in the command reference

Dashboard settings#

SettingTypeMeaning
Auto-clear module enabledToggleTurns the AutoClear module on or off. While it is off, no rules run.
Delete afterNumberDelay per channel before messages are deleted. In the form you enter a value and a unit: seconds, minutes, hours or days. Default: 3600 seconds (1 hour).
Default: 3600 (1 h)
Only affect these roles (empty = all)RoleIf one or more roles are selected, the rule only affects messages from members with those roles. Empty means: all members.
Whitelist (message IDs, never deleted)TextList of message IDs this rule never deletes. Only valid IDs of 17–20 digits are accepted.
CommandsToggleDeletes messages that look like command calls or command replies. Enabled by default.
Bot messagesToggleDeletes messages from bots. Enabled by default.
LinksToggleDeletes messages containing links. Disabled by default.
EverythingToggleDeletes every message in the channel. While “Everything” is on, the other filters are greyed out. Disabled by default.

Pitfalls#

  • In the affected channels the bot needs the “Manage Messages” permission, otherwise it cannot delete.
  • “Everything” overrides the individual filters: while it is on, commands, bot messages and links are no longer checked separately.
  • Each rule applies only to its own channel. A channel can have only one rule.
Last updated