From ac59f57ac9fef0061166726f2fa4ff730cf04b2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C6=B0u=20Quang=20V=C5=A9?= Date: Wed, 9 Sep 2026 14:06:45 +0700 Subject: [PATCH] Remove the `telegram_bot_api_url` setting because it requires too many manual configuration steps --- scripts/telegram_bot_handle_tool.py | 12 ++---------- send_to_telegram_full_llm.yaml | 1 - telegram_bot_webhook.yaml | 1 - 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/scripts/telegram_bot_handle_tool.py b/scripts/telegram_bot_handle_tool.py index 75da7c5..27ac3ef 100644 --- a/scripts/telegram_bot_handle_tool.py +++ b/scripts/telegram_bot_handle_tool.py @@ -19,11 +19,7 @@ if TOKEN: TOKEN = TOKEN.strip() -if ( - API_URL := pyscript.config.get("telegram_bot_api_url") # noqa: F821 # ty:ignore[unresolved-reference] - or "https://api.telegram.org" -): - API_URL = API_URL.strip().rstrip("/") +API_URL = "https://api.telegram.org" _session: httpx.AsyncClient | None = None _session_lock = asyncio.Lock() @@ -132,11 +128,7 @@ async def _get_file(client: httpx.AsyncClient, file_id: str) -> tuple[str | None if not resp.is_success or not result.get("ok"): description = result.get("description") or resp.reason_phrase or f"HTTP {resp.status_code}" if "file is too big" in description.lower(): - return ( - None, - f"File size exceeds Telegram Bot API 20MB download limit for public servers ({description}). " - "To download files up to 2GB, configure a local Telegram Bot API server via 'telegram_bot_api_url'.", - ) + return (None, f"File size exceeds Telegram Bot API 20MB download limit for public servers ({description}).") return None, f"Telegram API error ({resp.status_code}): {description}" if file_path := result.get("result", {}).get("file_path"): return file_path, None diff --git a/send_to_telegram_full_llm.yaml b/send_to_telegram_full_llm.yaml index 644d51f..27ab045 100644 --- a/send_to_telegram_full_llm.yaml +++ b/send_to_telegram_full_llm.yaml @@ -23,7 +23,6 @@ blueprint: allow_all_imports: true hass_is_global: true telegram_bot_token: !secret telegram_bot_token - telegram_bot_api_url: http://localhost:8081 # Optional: local Telegram Bot API server for downloading/uploading files up to 2GB ``` ``` diff --git a/telegram_bot_webhook.yaml b/telegram_bot_webhook.yaml index 7b252d3..48d6904 100644 --- a/telegram_bot_webhook.yaml +++ b/telegram_bot_webhook.yaml @@ -25,7 +25,6 @@ blueprint: allow_all_imports: true hass_is_global: true telegram_bot_token: !secret telegram_bot_token - telegram_bot_api_url: http://localhost:8081 # Optional: local Telegram Bot API server for downloading/uploading files up to 2GB ``` ```