From 3da019b8c7d64d9c0052873d3e61dbc61fc07e34 Mon Sep 17 00:00:00 2001 From: sarah Date: Mon, 23 Mar 2026 15:03:50 +0100 Subject: [PATCH] Docs: Add purge command to README and AGENTS-BOT.md - Added purge subcommands to admin command list - Documented purge implementation details in AGENTS-BOT.md - Listed Discord API constraints (100 message limit, 14 day filter) Co-Authored-By: Claude Opus 4.6 --- AGENTS-BOT.md | 25 ++++++++++++++++++++++++- README.md | 4 ++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/AGENTS-BOT.md b/AGENTS-BOT.md index 8132b34..26f0e60 100644 --- a/AGENTS-BOT.md +++ b/AGENTS-BOT.md @@ -351,6 +351,29 @@ if (unit === 'perm') { } ``` +### 11. Purge Command (Message Deletion) + +**Subcommands:** +- `purge amount <1-100>` - Delete X messages +- `purge time ` - Delete messages from last X time +- `purge user <1-100>` - Delete X messages from specific user +- `purge all` - Delete all possible messages (max 100) + +**Discord API Constraints:** +- Max 100 messages per bulk delete +- Messages older than 14 days cannot be bulk deleted +- Requires `ModerateMembers` permission + +```typescript +// Filter messages older than 14 days (Discord API limit) +const twoWeeksAgo = Date.now() - 14 * 24 * 60 * 60 * 1000; +const filtered = messages.filter((m: any) => m.createdTimestamp > twoWeeksAgo); + +await channel.bulkDelete(filtered, true); +``` + +**Logging:** Purge actions are logged to the moderation log channel with event type `messages`. + ## 🚀 Build & Deploy ```bash @@ -388,5 +411,5 @@ docker-compose up -d --build | `/timer` | add, remove, list, listall, help | Public/Admin | | `/welcome` | setchannel, add, remove, list, help | Admin | | `/log` | setchannel, enable, disable, list, help | Admin | -| `/admin` | kick, warn, unwarn, mute, unmute, ban, unban, config, help | Admin | +| `/admin` | kick, warn, unwarn, mute, unmute, ban, unban, purge, config, help | Admin | | `/owner` | deploy, stats, servers, help | Owner | \ No newline at end of file diff --git a/README.md b/README.md index a8b26a5..e00be73 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,10 @@ npm run deploy - `/admin unmute ` – Nutzer entmuten - `/admin ban ` – Nutzer bannen - `/admin unban ` – Nutzer entbannen +- `/admin purge amount <1-100>` – X Nachrichten löschen +- `/admin purge time ` – Nachrichten der letzten X Zeit löschen +- `/admin purge user <1-100>` – X Nachrichten eines Nutzers löschen +- `/admin purge all` – Alle Nachrichten löschen (max 100) - `/admin config` – Warn-System konfigurieren - `/admin help` – Admin-Hilfe