Command exited with code 0. Command output: if not self.api_id or not self.api_hash or not self.bot_token: raise RuntimeError("bridge_config.json must contain api_id, api_hash, and bot_token/token.") DATA_DIR.mkdir(parents=True, exist_ok=True) USERS_DIR.mkdir(parents=True, exist_ok=True) SESSIONS_DIR.mkdir(parents=True, exist_ok=True) # High-performance TCP connector with DNS caching & warm keepalive connector = aiohttp.TCPConnector( limit=5000, use_dns_cache=True, ttl_dns_cache=600, keepalive_timeout=90, enable_cleanup_closed=True, ) self.http = aiohttp.ClientSession(connector=connector) self._migrate_legacy_workspace_if_needed() self._migrate_fcm_urls() self._sync_old_fcm_creds() self.bot.add_handler(MessageHandler(self._handle_bot_message)) try: await self.bot.start() except FloodWait as exc: log(f"[FLOOD WAIT] Telegram bot auth rate limited. Required wait: {exc.value}s (~{round(exc.value/60, 1)}m). Sleeping to avoid PM2 crash loop...") await asyncio.sleep(exc.value + 5) await self.bot.start() if self.logs_group_id: try: target_gid = int(self.logs_group_id) if str(self.logs_group_id).lstrip("-").isdigit() else self.logs_group_id await self.bot.get_chat(target_gid) log(f"Successfully primed logs_group_id: {self.logs_group_id}") except Exception as e: log(f"Warning: Could not prime logs_group_id {self.logs_group_id}: {e}") self.main_client = self._build_main_client() session_file = LEGACY_SESSION_BASE.with_suffix(".session") if session_file.exists(): try: await self.main_client.connect() auth_status = await self.main_client.get_me() if auth_status: await self.main_client.disconnect() await self.main_client.start() self.main_client_ready = True self.main_client.add_handler(MessageHandler(self._on_main_message)) async for _ in self.main_client.get_dialogs(): pass else: await self.main_client.disconnect() log("Main session is not authorized. Please login via bot.") self.main_client_ready = False except AuthKeyDuplicated as exc: log(f"Main session duplicated: {exc}. Retrying with a fresh session file.") self._quarantine_main_session_files() self.main_client_ready = False except Exception as exc: log(f"Main Telegram session could not start: {exc}. Please login via bot.") self.main_client_ready = False else: log("Main session not found. Please login via the Telegram bot menu (Login Main Account).") self.main_client_ready = False log("Bot service started.") for path in USERS_DIR.glob("*.json"): if path.is_file(): uid = path.stem if uid not in self.workspaces: self.load_workspace(uid) self._seed_existing_firebases() for user_id, ws in list(self.workspaces.items()): if ws.active and ws.device_id: try: await self.ensure_bridge_runtime(ws) except Exception as exc: log(f"Failed to restore bridge runtime for user {user_id}: {exc}") log("Ready for multi-user menu flow.") await asyncio.Event().wait() def _migrate_legacy_workspace_if_needed(self) -> None: if not self.legacy_owner_id: return legacy_path = self.workspace_path(self.legacy_owner_id) if legacy_path.exists(): return