File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -571,6 +571,12 @@ async def cmd_timezone(update: Update, ctx: ContextTypes.DEFAULT_TYPE):
571571 f"🔔 Rescheduled reminders for { count } active user(s)." ,
572572 parse_mode = "Markdown" ,
573573 )
574+
575+ async def post_init (app : Application ):
576+ scheduler .start ()
577+ log .info ("Scheduler started" )
578+
579+
574580# ═══════════════════════════════════════════════════════════════════════════
575581# ENTRY POINT
576582# ═══════════════════════════════════════════════════════════════════════════
@@ -580,7 +586,7 @@ def main():
580586 print ("❌ BOT_TOKEN environment variable not set!" )
581587 return
582588
583- app = Application .builder ().token (BOT_TOKEN ).build ()
589+ app = Application .builder ().token (BOT_TOKEN ).post_init ( post_init ). build ()
584590
585591 app .add_handler (CommandHandler ("start" , cmd_start ))
586592 app .add_handler (CommandHandler ("help" , cmd_help ))
@@ -594,8 +600,6 @@ def main():
594600 app .add_handler (CommandHandler ("timezone" , cmd_timezone ))
595601 app .add_handler (MessageHandler (filters .TEXT & ~ filters .COMMAND , handle_message ))
596602
597-
598- scheduler .start ()
599603 log .info ("Chronos Bot running — timezone: %s" , TIMEZONE )
600604 app .run_polling (allowed_updates = Update .ALL_TYPES )
601605
You can’t perform that action at this time.
0 commit comments