feat(telegram): add dedicated TELEGRAM_PROXY env var and config.yaml proxy_url support
Pass platform_env_var="TELEGRAM_PROXY" to resolve_proxy_url() in both telegram.py (main connect) and telegram_network.py (fallback transport), so a Telegram-specific proxy takes priority over the generic HTTPS_PROXY. Also bridge telegram.proxy_url from config.yaml to the TELEGRAM_PROXY env var (env var takes precedence if both are set), add OPTIONAL_ENV_VARS entry, docs, and tests. Composite salvage of four community PRs: - Core approach (both call sites): #9414 by @leeyang1990 - config.yaml bridging + docs: #6530 by @WhiteWorld - Naming convention: #9074 by @brantzh6 - Earlier proxy work: #7786 by @ten-ltw Closes #9414, closes #9074, closes #7786, closes #6530 Co-authored-by: WhiteWorld <WhiteWorld@users.noreply.github.com> Co-authored-by: brantzh6 <brantzh6@users.noreply.github.com> Co-authored-by: ten-ltw <ten-ltw@users.noreply.github.com>
This commit is contained in:
@@ -170,6 +170,7 @@ For cloud sandbox backends, persistence is filesystem-oriented. `TERMINAL_LIFETI
|
||||
| `TELEGRAM_WEBHOOK_SECRET` | Secret token for verifying updates come from Telegram |
|
||||
| `TELEGRAM_REACTIONS` | Enable emoji reactions on messages during processing (default: `false`) |
|
||||
| `TELEGRAM_IGNORED_THREADS` | Comma-separated Telegram forum topic/thread IDs where the bot never responds |
|
||||
| `TELEGRAM_PROXY` | Proxy URL for Telegram connections — overrides `HTTPS_PROXY`. Supports `http://`, `https://`, `socks5://` |
|
||||
| `DISCORD_BOT_TOKEN` | Discord bot token |
|
||||
| `DISCORD_ALLOWED_USERS` | Comma-separated Discord user IDs allowed to use the bot |
|
||||
| `DISCORD_HOME_CHANNEL` | Default Discord channel for cron delivery |
|
||||
|
||||
@@ -172,6 +172,27 @@ fly deploy
|
||||
|
||||
The gateway log should show: `[telegram] Connected to Telegram (webhook mode)`.
|
||||
|
||||
## Proxy Support
|
||||
|
||||
If Telegram's API is blocked or you need to route traffic through a proxy, set a Telegram-specific proxy URL. This takes priority over the generic `HTTPS_PROXY` / `HTTP_PROXY` env vars.
|
||||
|
||||
**Option 1: config.yaml (recommended)**
|
||||
|
||||
```yaml
|
||||
telegram:
|
||||
proxy_url: "socks5://127.0.0.1:1080"
|
||||
```
|
||||
|
||||
**Option 2: environment variable**
|
||||
|
||||
```bash
|
||||
TELEGRAM_PROXY=socks5://127.0.0.1:1080
|
||||
```
|
||||
|
||||
Supported schemes: `http://`, `https://`, `socks5://`.
|
||||
|
||||
The proxy applies to both the main Telegram connection and the fallback IP transport. If no Telegram-specific proxy is set, the gateway falls back to `HTTPS_PROXY` / `HTTP_PROXY` / `ALL_PROXY` (or macOS system proxy auto-detection).
|
||||
|
||||
## Home Channel
|
||||
|
||||
Use the `/sethome` command in any Telegram chat (DM or group) to designate it as the **home channel**. Scheduled tasks (cron jobs) deliver their results to this channel.
|
||||
|
||||
Reference in New Issue
Block a user