From be412168bb5eedfe402502e7da612dd2ecb550f5 Mon Sep 17 00:00:00 2001 From: Zichao Lin Date: Thu, 2 Jul 2026 20:56:30 +0800 Subject: [PATCH] fix: also delete user's message when cleaning up reply/hint flow --- src/tg_bot.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tg_bot.py b/src/tg_bot.py index 540f554..074e1ad 100644 --- a/src/tg_bot.py +++ b/src/tg_bot.py @@ -320,6 +320,7 @@ def _handle_message(tg_cfg: TelegramConfig, cfg: Config, msg: dict): if not conv: return + user_msg_id = msg["message_id"] chat_id_str = str(chat_id) prompt_msg_id = conv.get("prompt_msg_id") @@ -327,10 +328,12 @@ def _handle_message(tg_cfg: TelegramConfig, cfg: Config, msg: dict): ctx = _email_contexts.get(conv["summary_msg_id"]) if not ctx: _conversations.pop(chat_id, None) + delete_message(tg_cfg, chat_id_str, user_msg_id) if prompt_msg_id: delete_message(tg_cfg, chat_id_str, prompt_msg_id) return + delete_message(tg_cfg, chat_id_str, user_msg_id) if prompt_msg_id: delete_message(tg_cfg, chat_id_str, prompt_msg_id) _do_send_reply(tg_cfg, cfg, chat_id, conv["summary_msg_id"], ctx, text) @@ -341,10 +344,12 @@ def _handle_message(tg_cfg: TelegramConfig, cfg: Config, msg: dict): ctx = _email_contexts.get(conv["summary_msg_id"]) if not ctx: _conversations.pop(chat_id, None) + delete_message(tg_cfg, chat_id_str, user_msg_id) if prompt_msg_id: delete_message(tg_cfg, chat_id_str, prompt_msg_id) return + delete_message(tg_cfg, chat_id_str, user_msg_id) if prompt_msg_id: delete_message(tg_cfg, chat_id_str, prompt_msg_id) try: