feat: conditionally set telegram proxy

This commit is contained in:
alan 2026-02-07 22:18:43 +08:00
parent 3166c15cff
commit cf1663af13

View File

@ -101,13 +101,10 @@ class TelegramChannel(BaseChannel):
self._running = True
# Build the application
self._app = (
Application.builder()
.token(self.config.token)
.proxy(self.config.proxy)
.get_updates_proxy(self.config.proxy)
.build()
)
builder = Application.builder().token(self.config.token)
if self.config.proxy:
builder = builder.proxy(self.config.proxy).get_updates_proxy(self.config.proxy)
self._app = builder.build()
# Add message handler for text, photos, voice, documents
self._app.add_handler(