Purge worker service for PurgeBot. Consumes jobs from the Redis queue and performs message deletion on Discord.
- Dequeues purge jobs from Redis
- Resolves the target (server, category, or channel) into a list of channels and threads
- Fetches messages in batches and applies filters (date, content, author type)
- Bulk-deletes messages newer than 14 days; individually deletes older ones
- Keeps one live progress surface per run, moving one way only as each is refused: interaction response, channel message, then a direct message to whoever started the purge
- Records completed purge jobs to the database for stats
All configuration is loaded from environment variables (see .env.example in the docker repo).
| Variable | Description |
|---|---|
DISCORD_TOKEN |
Bot token |
DISCORD_APPLICATION_ID |
Application ID |
DATABASE_* |
PostgreSQL connection |
REDIS_ADDR, REDIS_PASSWORD, REDIS_DB |
Redis connection |
WORKER_CONCURRENCY |
Purge workers to run in parallel (default 4) |
PURGE_CHANNEL_CONCURRENCY |
Channels of one purge to delete from at once, 0 for every channel (default 10) |
SENTRY_DSN |
Sentry error reporting (optional) |
LOG_LEVEL |
debug, info, warn, error |
LOG_JSON |
true for JSON log output |