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.

This commit is contained in:
2026-07-17 20:04:27 +08:00
parent b2e219ece5
commit 2f29e03cec

View File

@@ -453,7 +453,8 @@ def _handle_callback(tg_cfg: TelegramConfig, cfg: Config, cb: dict):
def _handle_message(tg_cfg: TelegramConfig, cfg: Config, msg: dict): def _handle_message(tg_cfg: TelegramConfig, cfg: Config, msg: dict):
chat_id = msg["chat"]["id"] 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) conv = load_conversation(chat_id)
if not conv: if not conv: