Changed from 'Auto-Restarted' to 'Restarted' and made the message
generic since the bot restarts for multiple reasons (manual, deployment,
healthcheck) - not just healthcheck failures.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Discord webhooks require a User-Agent header or they return 403 Forbidden.
Added 'Paper-Dynasty-Discord-Bot/1.0' as User-Agent.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Sends instant notifications to Discord when the bot restarts, helping
track stability issues and auto-recovery events.
Changes:
- Add notify_restart.py script to send webhook notifications
- Integrate notification into bot startup (on_ready event)
The notification includes:
- Timestamp of restart (CST)
- Reason (healthcheck failure detection)
- Reference to diagnostics logs
Configuration:
Set RESTART_WEBHOOK_URL environment variable in docker-compose.yml
to enable notifications.
This provides immediate visibility when Docker auto-restarts the bot
due to crashes or healthcheck failures.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Adds idempotency guard to prevent race conditions when multiple users
submit commands for the same play simultaneously.
Changes:
- Add PlayLockedException for locked play detection
- Implement lock check in checks_log_interaction()
- Acquire lock (play.locked = True) before processing commands
- Release lock (play.locked = False) after play completion
- Add warning logs for rejected duplicate submissions
- Add /diagnostics endpoint to health server for debugging
This prevents database corruption and duplicate processing when users
spam commands like "log xcheck" while the first is still processing.
Tested successfully in Discord - duplicate commands now properly return
PlayLockedException with instructions to wait.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>