From 2f29e03cecae734d54d1302d4d96ad5b483f3d97 Mon Sep 17 00:00:00 2001 From: Zichao Lin Date: Fri, 17 Jul 2026 20:04:27 +0800 Subject: [PATCH] fix: read Telegram caption field for media messages Telegram sends text in 'caption' field (not 'text') when message has media. Handle both cases: text or caption, with text taking priority. --- src/tg_bot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tg_bot.py b/src/tg_bot.py index 04f046f..fcd9eaf 100644 --- a/src/tg_bot.py +++ b/src/tg_bot.py @@ -453,7 +453,8 @@ def _handle_callback(tg_cfg: TelegramConfig, cfg: Config, cb: dict): def _handle_message(tg_cfg: TelegramConfig, cfg: Config, msg: dict): chat_id = msg["chat"]["id"] - text = msg.get("text", "").strip() + text = msg.get("text") or msg.get("caption") or "" + text = text.strip() conv = load_conversation(chat_id) if not conv: