diff --git a/telegram_bot_commands.py b/telegram_bot_commands.py index f80c7bd..4848913 100644 --- a/telegram_bot_commands.py +++ b/telegram_bot_commands.py @@ -252,8 +252,13 @@ class TelegramBotCommander: async def start_async(self): """Start bot asynchronously (new API)""" - # Create application - self.application = Application.builder().token(self.bot_token).build() + # Create application (disable job queue to avoid timezone issues) + self.application = ( + Application.builder() + .token(self.bot_token) + .job_queue(None) # Disable job queue - fixes timezone error + .build() + ) # Add command handlers self.application.add_handler(CommandHandler("start", self.cmd_start)) @@ -289,7 +294,20 @@ class TelegramBotCommander: def start_background(self): """Start bot in background thread""" def run_async_loop(): - asyncio.run(self.start_async()) + try: + # Create new event loop for this thread + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + + # Run bot + loop.run_until_complete(self.start_async()) + + # Keep loop running + loop.run_forever() + except Exception as e: + print(f"❌ Bot thread error: {e}") + import traceback + traceback.print_exc() thread = threading.Thread(target=run_async_loop, daemon=True) thread.start()