fix: also delete user's message when cleaning up reply/hint flow

This commit is contained in:
2026-07-02 20:56:30 +08:00
parent 08a1a32367
commit be412168bb

View File

@@ -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: