From f6f94e52556822d2fad36524bef2a55ae7706849 Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 13 Nov 2022 03:13:11 +0300 Subject: [PATCH] Improve getRepliedMessage. --- td/generate/scheme/td_api.tl | 2 +- td/telegram/MessagesManager.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 1528cc2ee..e1073c909 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -4893,7 +4893,7 @@ getMessage chat_id:int53 message_id:int53 = Message; //@description Returns information about a message, if it is available without sending network request. This is an offline request @chat_id Identifier of the chat the message belongs to @message_id Identifier of the message to get getMessageLocally chat_id:int53 message_id:int53 = Message; -//@description Returns information about a message that is replied by a given message. Also returns the pinned message, the game message, and the invoice message for messages of the types messagePinMessage, messageGameScore, and messagePaymentSuccessful respectively +//@description Returns information about a message that is replied by a given message. Also returns the pinned message, the game message, the invoice message, and the topic creation message for messages of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, and service topic messages respectively //@chat_id Identifier of the chat the message belongs to @message_id Identifier of the reply message getRepliedMessage chat_id:int53 message_id:int53 = Message; diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index ce091ac35..0041970b3 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -18446,6 +18446,9 @@ FullMessageId MessagesManager::get_replied_message_id(DialogId dialog_id, const return full_message_id; } if (m->reply_to_message_id == MessageId()) { + if (m->top_thread_message_id.is_valid() && is_service_message_content(m->content->get_type())) { + return {dialog_id, m->top_thread_message_id}; + } return {}; } return {m->reply_in_dialog_id.is_valid() ? m->reply_in_dialog_id : dialog_id, m->reply_to_message_id};