Backup automatico script del 2026-07-26 07:00
This commit is contained in:
1 parent
4802b021fe
commit
a9bbb92090
19 files changed
+1086
-550
No files matched your search
@@ -758,6 +758,14 @@ async def meteo_viaggio_command(update: Update, context: ContextTypes.DEFAULT_TY
|
||||
|
||||
async def scheduled_morning_report(context: ContextTypes.DEFAULT_TYPE) -> None:
|
||||
# Stesso comportamento di `/meteo` senza argomenti: Casa (+ viaggio se attivo) per utente.
|
||||
try:
|
||||
from telegram_gate import telegram_alerts_enabled
|
||||
if not telegram_alerts_enabled():
|
||||
logger.info("Report meteo mattutino sospeso (LOOGLE_TELEGRAM_ALERTS=0).")
|
||||
return
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
report_casa = call_meteo_script(["--home"])
|
||||
for uid in ALLOWED_IDS:
|
||||
chat_id = str(uid)
|
||||
@@ -892,7 +900,21 @@ def main():
|
||||
application.add_handler(CallbackQueryHandler(button_handler))
|
||||
|
||||
job_queue = application.job_queue
|
||||
job_queue.run_daily(scheduled_morning_report, time=datetime.time(hour=7, minute=15, tzinfo=TZINFO), days=(0, 1, 2, 3, 4, 5, 6))
|
||||
# Report meteo quotidiano 07:15 — sospeso se LOOGLE_TELEGRAM_ALERTS=0 (cron-alerts.env)
|
||||
try:
|
||||
from telegram_gate import telegram_alerts_enabled
|
||||
morning_enabled = telegram_alerts_enabled()
|
||||
except Exception:
|
||||
morning_enabled = True
|
||||
if morning_enabled:
|
||||
job_queue.run_daily(
|
||||
scheduled_morning_report,
|
||||
time=datetime.time(hour=7, minute=15, tzinfo=TZINFO),
|
||||
days=(0, 1, 2, 3, 4, 5, 6),
|
||||
)
|
||||
logger.info("Job scheduled_morning_report attivo (07:15).")
|
||||
else:
|
||||
logger.info("Job scheduled_morning_report NON registrato (Telegram sospeso).")
|
||||
|
||||
application.run_polling()
|
||||
|
||||
|
||||
Reference in new issue
Block a user