feat: Add user blocklist for instant media deletion

Add blocklist feature to automatically delete ALL media (images, GIFs,
embeds, URLs) from specific users without AI analysis.

Changes:
- Add blocked_user_ids config field to config.yml
- Implement blocklist check in ai_moderation.py (runs before AI checks)
- Update README.md with blocklist documentation

Benefits:
- No AI cost (instant deletion)
- Useful for known spam accounts or problematic users
- Blocks all media types: attachments, embeds, URLs
- Logged for moderation tracking
This commit is contained in:
2026-01-27 19:58:40 +01:00
parent df8da05f36
commit cb6049361e
3 changed files with 51 additions and 7 deletions

View File

@@ -138,6 +138,10 @@ ai_moderation:
check_video_thumbnails: false # Skip video thumbnails
url_image_check_enabled: false # Skip URL image downloads
# User blocklist (blocks ALL media from specific users)
blocked_user_ids:
- 123456789012345678 # Discord user ID to block
# Known NSFW video domains (auto-block)
nsfw_video_domains:
- pornhub.com
@@ -160,6 +164,12 @@ nsfw_video_domains:
- `duplicate_threshold`: How many duplicate messages trigger action
- `mention_limit`: Max @mentions allowed per message
**User Blocklist:**
- `blocked_user_ids`: List of Discord user IDs to block
- Automatically deletes ALL images, GIFs, embeds, and URLs from these users
- No AI cost - instant deletion
- Useful for known problematic users or spam accounts
**Cost Controls:**
The bot includes multiple layers of cost control:
- Rate limiting (25 AI checks/hour/guild, 5/hour/user by default)
@@ -222,6 +232,12 @@ guardden/
## How It Works
### User Blocklist (Instant, No AI Cost)
1. Checks if message author is in `blocked_user_ids` list
2. If message contains ANY media (images, embeds, URLs), instantly deletes it
3. No AI analysis needed - immediate action
4. Useful for known spam accounts or problematic users
### Spam Detection
1. Bot monitors message rate per user
2. Detects duplicate messages
@@ -229,12 +245,13 @@ guardden/
4. Violations result in message deletion + timeout
### NSFW Image Detection
1. Bot checks attachments and embeds for images
2. Applies rate limiting and deduplication
3. Downloads image and sends to AI provider
4. AI analyzes for NSFW content categories
5. Violations result in message deletion + timeout
6. Optionally checks known NSFW video domain links
1. Checks user blocklist first (instant deletion if matched)
2. Checks NSFW video domain blocklist (instant deletion)
3. Bot checks attachments and embeds for images
4. Applies rate limiting and deduplication
5. Downloads image and sends to AI provider
6. AI analyzes for NSFW content categories
7. Violations result in message deletion + timeout
### Cost Management
The bot includes aggressive cost controls for AI usage: