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: