From 43e3c3b63b989e777ee1b317c47031719682bfed Mon Sep 17 00:00:00 2001 From: Simbiot Harness Date: Tue, 29 Sep 2026 17:12:47 +0000 Subject: [PATCH] =?UTF-8?q?tg=5Finbox:=20=D1=81=D0=BE=D1=85=D1=80=D0=B0?= =?UTF-8?q?=D0=BD=D1=8F=D1=82=D1=8C=20file=5Fid/=D0=B4=D0=BB=D0=B8=D1=82?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=BD=D0=BE=D1=81=D1=82=D1=8C=20=D0=B3=D0=BE?= =?UTF-8?q?=D0=BB=D0=BE=D1=81=D0=BE=D0=B2=D1=8B=D1=85=20=D0=B8=20=D1=84?= =?UTF-8?q?=D0=BE=D1=82=D0=BE=20(=D0=BD=D1=83=D0=B6=D0=BD=D0=BE=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D1=82=D1=80=D0=B0=D0=BD=D1=81=D0=BA=D1=80=D0=B8?= =?UTF-8?q?=D0=BF=D1=86=D0=B8=D0=B8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- harness/tg_inbox.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/harness/tg_inbox.py b/harness/tg_inbox.py index 3f4a9d1..3ae54a5 100644 --- a/harness/tg_inbox.py +++ b/harness/tg_inbox.py @@ -73,6 +73,14 @@ def receive_message(update: dict): kind = "document" elif msg.get("animation"): kind = "animation" + # file_id нужен, чтобы потом скачать файл (голосовое → транскрипция, фото → OCR) + file = (msg.get("voice") or msg.get("audio") or msg.get("document") + or msg.get("video") or msg.get("video_note") or {}) + file_id = file.get("file_id") + duration = file.get("duration") or file.get("duration_seconds") + photo = msg.get("photo") + if photo and not file_id: + file_id = photo[-1].get("file_id") # самый большой размер data = { "update_id": update["update_id"], "chat_id": chat.get("id"), @@ -81,6 +89,8 @@ def receive_message(update: dict): "first_name": user.get("first_name"), "text": (msg.get("text") or msg.get("caption") or "")[:4000], "kind": kind, + "file_id": file_id, + "duration": duration, "date": msg.get("date"), } es.append_event("inbox", f"m-{update['update_id']}", "MessageReceived", data)