Auto Delete - CosmicCubicle/PariahBot GitHub Wiki

Auto-Delete

Keeps a channel tidy on a rolling basis. Each message is deleted once it's older than a set time, or once a set number of newer messages exist, whichever comes first. It's modelled on the AutoDelete bot.

Good for #bot-commands, #memes, LFG channels, or anywhere old messages don't matter.


Set it up

/autodelete set channel:#memes duration:24h count:100
Option Effect
channel The channel to clean. Defaults to the one you run the command in
duration Delete messages once they're this old. Use h, m and s, alone or combined: 24h, 30m, 90s, 1h30m
count Keep at most this many messages. The oldest go first

Give duration, count, or both. Running set again on the same channel updates its settings.

Pinned messages are never deleted, whatever their age or position. Pin anything that should stay.


How it works

  • It starts straight away. When a channel is set up, and every time the bot starts, it reads the channel's latest 100 messages and deletes any that are already due.
  • New messages count from when they're posted.
  • Age is checked every 60 seconds, so a message can last up to a minute past its time. A quiet channel is still cleaned.
  • Messages already deleted by someone else are ignored.

Check or turn off

/autodelete status channel:#memes
/autodelete disable channel:#memes

Both default to the channel you run them in.


Troubleshooting

What happens Fix
Nothing is deleted Check /autodelete status in that channel. The bot needs Manage Messages and Read Message History there
A message stayed Pinned messages are never deleted. Time-based deletion can also run up to a minute late
Old messages from before setup are still there Only the latest 100 are read at setup and startup. Delete older ones by hand

Permissions needed: Manage Messages and Read Message History. See Permissions.