From 0250410ca754b8f24594df608536bcf085dd1efa Mon Sep 17 00:00:00 2001
From: Roman Sergienko <romasergienko@outlook.com>
Date: Sun, 11 Oct 2026 16:29:50 +0000
Subject: [PATCH] feat web: чат пузырями (свои/чужие), превью реплаев, подгрузка фото/стикеров/медиа через бота
---
web/views.py | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/web/views.py b/web/views.py
index 936167f..644d0c8 100644
--- a/web/views.py
+++ b/web/views.py
@@ -247,10 +247,20 @@
return web.json_response({"ok": False, "msg": "Пустое сообщение."}, status=400)
name = user.get("first_name") or str(user["user_id"])
ts = now_ts()
+ reply_to_name = ""
+ reply_to_text = ""
+ if reply_id:
+ rm = await db.find_msg_by_tg(chat_id, reply_id)
+ if rm:
+ reply_to_name = rm["name"] or ""
+ reply_to_text = (rm["text"] or "")[:80]
tg_id = await _deliver(chat_id, name, text, reply_id)
if tg_id < 0:
return web.json_response({"ok": False, "msg": "Не удалось отправить. Проверьте права бота."}, status=502)
- mid = await db.add_msg(chat_id, user["user_id"], f"Amadeus / {name}", text, ts, tg_id)
+ mid = await db.add_msg(
+ chat_id, user["user_id"], f"Amadeus / {name}", text, ts, tg_id,
+ reply_to_tg=reply_id, reply_to_name=reply_to_name, reply_to_text=reply_to_text,
+ )
await db.add_log(chat_id, user["user_id"], 0, "say", text[:200], ts)
return web.json_response({
"ok": True,
@@ -258,6 +268,8 @@
"id": mid, "chat_id": chat_id, "user_id": user["user_id"],
"name": f"Amadeus / {name}", "text": text, "created_at": ts,
"tg_msg_id": tg_id, "time": fmt_dt(ts),
+ "media_type": "", "media_file_id": "",
+ "reply_to_tg": reply_id, "reply_to_name": reply_to_name, "reply_to_text": reply_to_text,
},
})
--
Gitblit v1.9.3