From 01744029d855a7a2d4648c16a0ecd9073511c8e6 Mon Sep 17 00:00:00 2001
From: astvacp
Date: Tue, 3 Mar 2026 18:08:50 +0700
Subject: [PATCH] fix problem with proxy for Telegram
This PR fixes problem with proxy for Telegram
---
nanobot/channels/telegram.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/nanobot/channels/telegram.py b/nanobot/channels/telegram.py
index c290535..dd05315 100644
--- a/nanobot/channels/telegram.py
+++ b/nanobot/channels/telegram.py
@@ -140,10 +140,14 @@ class TelegramChannel(BaseChannel):
self._running = True
# Build the application with larger connection pool to avoid pool-timeout on long runs
- req = HTTPXRequest(connection_pool_size=16, pool_timeout=5.0, connect_timeout=30.0, read_timeout=30.0)
+ req = HTTPXRequest(
+ connection_pool_size=16,
+ pool_timeout=5.0,
+ connect_timeout=30.0,
+ read_timeout=30.0,
+ proxy=self.config.proxy if self.config.proxy else None
+ )
builder = Application.builder().token(self.config.token).request(req).get_updates_request(req)
- if self.config.proxy:
- builder = builder.proxy(self.config.proxy).get_updates_proxy(self.config.proxy)
self._app = builder.build()
self._app.add_error_handler(self._on_error)