Add stale-donor alerting with per-route recipients and delivery fallback

New STALE_DONOR_ALERT_DAYS (.env, global threshold, 0=off) + per-route
stale_alert_enabled/stale_alert_ids (routes.json). Checked once per route
per cycle against MAX(posted_at) in the DB - self-resetting via a single
route_alerts.stale_alert_sent_at timestamp compared against the last post
time, so it fires once per quiet spell and re-arms automatically once the
donor posts again, no separate ack/clear step needed.

If a configured stale_alert_ids recipient can't be reached (never started
a chat with the bot), the global TG_ADMIN_IDS get a separate notice about
that delivery failure instead of the alert silently vanishing.
This commit is contained in:
2026-08-18 19:13:01 +05:00
parent ab69fff33b
commit 3a086d9e54
8 changed files with 180 additions and 10 deletions
+5
View File
@@ -76,6 +76,11 @@ REPORT_EMPTY_RUNS=false
REPORT_ON_ERROR=true
# Clean stale temp files older than X minutes (default: 30)
CACHE_MAX_AGE_MINUTES=30
# "Donor gone quiet" alerts: global threshold in days, 0 = feature off entirely.
# Only fires for routes with "stale_alert_enabled": true in routes.json (which also
# sets who gets notified - see routes.json.example). Self-resetting: alerts once
# per quiet spell, re-arms automatically once the donor posts again.
STALE_DONOR_ALERT_DAYS=0
# ==========================================
# Media & Video Limits