feat: persist alert results to SQLite history table

Matched results were announced then discarded. Add a dedicated SQLite
database (data/alert_history.db) to store every announced result with
channel, alert name, backend, title, URL, date, and timestamp. Add
!alert history <name> [n] subcommand to query recent results.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
user
2026-02-15 22:09:01 +01:00
parent 181d6dbfad
commit 122785b1f3
3 changed files with 103 additions and 4 deletions

View File

@@ -123,6 +123,7 @@ format = "text" # Log format: "text" (default) or "json"
| `!username <user>` | Check username across ~25 services |
| `!username <user> <service>` | Check single service |
| `!username list` | Show available services by category |
| `!alert <add\|del\|list\|check\|history>` | Keyword alert subscriptions across platforms |
| `!searx <query>` | Search SearXNG and show top results |
### Command Shorthand
@@ -666,6 +667,7 @@ simultaneously.
!alert del <name> Remove alert (admin)
!alert list List alerts
!alert check <name> Force-poll now
!alert history <name> [n] Show recent results (default 5, max 20)
```
- `add` and `del` require admin privileges
@@ -692,5 +694,7 @@ Polling and announcements:
- Each platform maintains its own seen list (capped at 200 per platform)
- 5 consecutive errors doubles the poll interval (max 1 hour)
- Subscriptions persist across bot restarts via `bot.state`
- Matched results are stored in `data/alert_history.db` (SQLite)
- `list` shows error status indicators next to each alert
- `check` forces an immediate poll across all platforms
- `history` queries stored results, most recent first