Auto-deletes Discord messages older than a configurable threshold from one or more channels.
| Variable | Required | Default | Description |
|---|---|---|---|
DISCORD_TOKEN |
yes | — | Bot token |
CHANNEL_IDS |
yes | — | Comma-separated channel IDs |
MAX_AGE |
yes | — | Message age threshold (e.g. 720h, 168h) |
SCHEDULE |
no | 0 */6 * * * |
Cron expression(s), semicolon-separated for multiple (e.g. 0 3 * * *;0 15 * * *) |
TZ |
no | UTC |
Timezone for schedules (e.g. Europe/Berlin) |
cp .env.example .env
# edit .env with your values
docker compose up -dgo build -o lethe .
DISCORD_TOKEN=... CHANNEL_IDS=123,456 MAX_AGE=720h ./lethe- Create an application at https://discord.com/developers/applications
- Go to Bot → copy the token → set as
DISCORD_TOKEN - Go to OAuth2 → URL Generator → select scope
bot - Select permissions: Manage Messages, Read Message History
- Open the generated URL to invite the bot to your server
- On start, immediately deletes all messages older than
MAX_AGE - Then repeats every
INTERVAL - Messages < 14 days old are bulk-deleted (up to 100 per API call)
- Messages >= 14 days old are deleted individually (Discord API limitation)
- Supports multiple channels via comma-separated
CHANNEL_IDS - Shows as online in Discord with "Watching cleanup" status
