Skip to content
/ lethe Public

hra42/lethe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lethe

lethe

Auto-deletes Discord messages older than a configurable threshold from one or more channels.

Environment Variables

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)

Quick Start

Docker Compose

cp .env.example .env
# edit .env with your values
docker compose up -d

Without Docker

go build -o lethe .
DISCORD_TOKEN=... CHANNEL_IDS=123,456 MAX_AGE=720h ./lethe

Discord Bot Setup

  1. Create an application at https://discord.com/developers/applications
  2. Go to Bot → copy the token → set as DISCORD_TOKEN
  3. Go to OAuth2URL Generator → select scope bot
  4. Select permissions: Manage Messages, Read Message History
  5. Open the generated URL to invite the bot to your server

How It Works

  • 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

License

Unlicense

About

Lethe is a lightweight, automated tool written in Go that periodically cleans up Discord channels by deleting messages older than a specified time threshold (e.g., 30 days old). It is designed to be easily deployed via Docker or as a standalone binary to keep Discord servers uncluttered.

Topics

Resources

License

Stars

Watchers

Forks

Contributors