diff --git a/gateway/platforms/telegram.py b/gateway/platforms/telegram.py index d8113eab0a..af447d565c 100644 --- a/gateway/platforms/telegram.py +++ b/gateway/platforms/telegram.py @@ -518,6 +518,16 @@ class TelegramAdapter(BasePlatformAdapter): # Build the application builder = Application.builder().token(self.config.token) + custom_base_url = self.config.extra.get("base_url") + if custom_base_url: + builder = builder.base_url(custom_base_url) + builder = builder.base_file_url( + self.config.extra.get("base_file_url", custom_base_url) + ) + logger.info( + "[%s] Using custom Telegram base_url: %s", + self.name, custom_base_url, + ) # PTB defaults (pool_timeout=1s) are too aggressive on flaky networks and # can trigger "Pool timeout: All connections in the connection pool are occupied" @@ -547,7 +557,6 @@ class TelegramAdapter(BasePlatformAdapter): for k in ("HTTPS_PROXY", "HTTP_PROXY", "ALL_PROXY", "https_proxy", "http_proxy", "all_proxy") ) disable_fallback = (os.getenv("HERMES_TELEGRAM_DISABLE_FALLBACK_IPS", "").strip().lower() in ("1", "true", "yes", "on")) - fallback_ips = self._fallback_ips() if not fallback_ips: fallback_ips = await discover_fallback_ips()