Add WS message filtering, idle grace period, webhook env var

- Browser WS clients can now send {"type": "subscribe", "message_types": [...]}
  to only receive specific message types. Default is all (no change for browsers).
- Discord bot subscribes to only "rare" and "chat" — eliminates 82GB+ of
  unnecessary telemetry/vitals/inventory traffic.
- Idle detection now has a 5-minute grace period before firing Discord alerts,
  preventing false positives on brief idle states.
- Added DISCORD_ACLOG_WEBHOOK env var to docker-compose.yml for death/idle alerts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-04-15 00:08:55 +02:00
parent 3885b408c9
commit de2cc3a0e3
3 changed files with 62 additions and 20 deletions

View file

@ -293,7 +293,15 @@ class DiscordRareMonitor:
# Send connection established message
await self.post_status_to_aclog("🔗 WebSocket connection established")
# Subscribe only to message types we care about (rare + chat)
# This dramatically reduces network traffic vs receiving the full firehose
await websocket.send(json.dumps({
"type": "subscribe",
"message_types": ["rare", "chat"]
}))
logger.info("📋 Subscribed to message types: rare, chat")
# Simple message processing with comprehensive error handling
try:
message_count = 0