Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/bot/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ async def initialize(self) -> None:
builder.write_timeout(30)
builder.pool_timeout(30)

# Explicitly set proxy from environment variables.
# This is necessary because python-telegram-bot's Application.builder()
# does not automatically use HTTP_PROXY/HTTPS_PROXY environment variables.
# Without this, the httpx connection pool can become corrupted when running
# behind a proxy, causing the bot to stop responding to messages.
import os

proxy_url = os.environ.get("HTTPS_PROXY") or os.environ.get("HTTP_PROXY")
if proxy_url:
builder.proxy(proxy_url)
logger.info("Proxy configured", proxy=proxy_url)

self.app = builder.build()

# Initialize feature registry
Expand Down