[HRT-79] Alertes Telegram configurables (Premium) #11
Reference in New Issue
Block a user
Delete Branch "feature/HRT-79-telegram-alerts"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
[HRT-79] Alertes Telegram configurables Premium/Pro
Résumé
Implémentation complète du service d'alertes Telegram pré-course pour les utilisateurs Premium/Pro.
Fichiers
Nouveaux fichiers
telegram_alerts.py— service envoi Bot API,send_pre_race_alerts(),build_race_alert(), gestion gracieuseTELEGRAM_BOT_TOKENabsent (warn + return early)api_v1/routes/user.py— blueprintuser_bp—GET/POST /api/v1/user/telegram-config— protégé@jwt_required_middleware+@plan_required("premium", "pro")Fichiers modifiés
auth_db.py—migrate_telegram_columns()idempotente (ALTER TABLE + try/except OperationalError) — colonnes:telegram_chat_id,alert_value_bets,alert_top1,alert_quinte_onlyapi_v1/__init__.py— import + registeruser_bp(9e blueprint)turf_scheduler.py—run_telegram_alerts()+schedule_dynamic_telegram_alerts()30min avant course — try/except Exception + fallback logger comme demandé CTOPoints CTO adressés
TELEGRAM_BOT_TOKENabsent → log warning + return early (pas de crash)schedule_dynamic_telegram_alerts()→ bloc try/except Exception + logger commeschedule_dynamic_results()auth_db.py.backup_20260429_163811,turf_scheduler.py.backup_20260429_163811Tests recommandés avant merge
python3 -c "import telegram_alerts; print(telegram_alerts.send_pre_race_alerts())"sans TELEGRAM_BOT_TOKEN → doit logger warning, retourner {sent:0}python3 auth_db.py→ vérifier migration idempotentecurl -H "Authorization: Bearer <jwt_premium>" /api/v1/user/telegram-config- telegram_alerts.py: service envoi alertes via Bot API (send_pre_race_alerts, build_race_alert, send_telegram_message) — gestion gracieuse TELEGRAM_BOT_TOKEN absent - auth_db.py: migrate_telegram_columns() idempotente (ALTER TABLE + try/except OperationalError) colonnes: telegram_chat_id, alert_value_bets, alert_top1, alert_quinte_only - api_v1/routes/user.py: blueprint user_bp GET/POST /api/v1/user/telegram-config protégé @jwt_required_middleware + @plan_required('premium','pro') - api_v1/__init__.py: import + register user_bp - turf_scheduler.py: run_telegram_alerts() + schedule_dynamic_telegram_alerts() planifiées 30min avant course (même pattern que schedule_dynamic_scoring) avec try/except Exception + fallback logger Co-Authored-By: Paperclip <noreply@paperclip.ing>