From 60e0835972fc9017dc14b4ee9fd9f585892c31e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tadeusz=20So=C5=9Bnierz?= Date: Mon, 29 Nov 2021 18:31:12 +0100 Subject: [PATCH] Don't require bot startup for bridge startup The bridge can function just fine without it, we don't need to treat it as a fatal error. --- mautrix_telegram/__main__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mautrix_telegram/__main__.py b/mautrix_telegram/__main__.py index 6ce33bfd..a644b1fc 100644 --- a/mautrix_telegram/__main__.py +++ b/mautrix_telegram/__main__.py @@ -100,8 +100,6 @@ def prepare_bridge(self) -> None: init_portal(self.context) self.add_startup_actions(init_puppet(self.context)) - if self.bot: - self.add_startup_actions(self.bot.start()) if self.config["bridge.resend_bridge_info"]: self.add_startup_actions(self.resend_bridge_info()) @@ -112,6 +110,12 @@ def prepare_bridge(self) -> None: async def start(self) -> None: await super().start() + if self.bot: + try: + await self.bot.start() + except Exception as e: + self.log.error(f"Failed to start bot: {e}") + semaphore = None concurrency = self.config['telegram.connection.concurrent_connections_startup'] if concurrency: