Delete Me Discord: Making Message History Ephemeral
Objective
I wanted Discord message history to behave like ephemeral chat: recent messages stay available, older messages are removed automatically.
The requirement was strict:
- one setup step
- no recurring UI work
- no recurring manual reconfiguration
Most alternatives I tried still depended on manual UI actions, so they did not meet that requirement.
Retention rule
The core behavior is deterministic retention:
- keep by count: preserve the last
--preserve-nmessages - keep by age: preserve messages newer than
--preserve-last - delete only when both preservation conditions are false
This makes the deletion boundary explicit and predictable across runs.
Daily automation
The companion repo delete-me-discord-workflow turns the tool into a daily job (default schedule: 02:00 UTC).
Setup is done once:
- store the token in
DISCORD_TOKEN - store CLI arguments in
DELETE_ME_ARGS - let GitHub Actions execute the job daily
CLI features that make this safe enough to automate
- include/exclude filters for channels, parents/categories, and guilds
- discovery commands (
--list-guilds,--list-channels) to target IDs before deletion --dry-runto preview behavior before execution- retention controls:
--preserve-last,--preserve-n,--preserve-n-mode - optional reaction cleanup via
--delete-reactions - fetch window control via
--fetch-max-agefor daily runs - JSON output for machine-readable logs
A technical detail that matters for recurring runs
Daily runs often use a limited fetch window (--fetch-max-age) for performance.
Without additional state, preserved messages can fall outside the current fetch window and disappear from evaluation.
With preserve cache enabled, preserved message IDs are carried across runs and merged back in.
This is the key property for long-term reliability: retention remains consistent over time, even when daily fetches only cover a recent slice of history.
Why this works well in practice
- no manual channel-by-channel cleanup
- no repeated UI workflow
- stable retention behavior over time
- exact control over scope via include/exclude IDs
- safe rollout via
--dry-run
What I learned
The most transferable part of this project was HTTP error handling in real API traffic:
- status-code classes and failure modes
- rate-limit handling
- retry and backoff behavior
That knowledge is still useful for my current work.
Links
Install:
pipx install delete-me-discord
CLI repo: github.com/janthmueller/delete-me-discord
Workflow repo: github.com/janthmueller/delete-me-discord-workflow
PyPI: pypi.org/project/delete-me-discord