From 7948c79377f19146daff004741327fb4f94c505a Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 13 Oct 2025 18:39:00 +0300 Subject: [PATCH] Use get_forum_topic_id instead of get_message_thread_id. --- telegram-bot-api/Client.cpp | 14 +++++++------- telegram-bot-api/Client.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index f89c818..757ad15 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -3676,9 +3676,9 @@ void Client::JsonMessage::store(td::JsonValueScope *scope) const { if (message_->edit_date > 0) { object("edit_date", message_->edit_date); } - auto message_thread_id = get_message_thread_id(message_->topic_id); - if (message_thread_id != 0) { - object("message_thread_id", as_client_message_id(message_thread_id)); + auto forum_topic_id = get_forum_topic_id(message_->topic_id); + if (forum_topic_id != 0) { + object("message_thread_id", forum_topic_id); } if (message_->initial_send_date > 0) { CHECK(message_->forward_origin != nullptr); @@ -7950,7 +7950,7 @@ bool Client::is_reply_in_same_topic(const object_ptr &repl switch (topic_id->get_id()) { case td_api::messageTopicForum::ID: { auto forum_topic_id = static_cast(topic_id.get())->forum_topic_id_; - return as_client_message_id(get_message_thread_id(reply_topic_id)) == forum_topic_id; + return get_forum_topic_id(reply_topic_id) == forum_topic_id; } case td_api::messageTopicDirectMessages::ID: // direct messages can't be answered in a different topic @@ -17189,19 +17189,19 @@ td::int64 Client::get_implicit_reply_to_message_id(int64 chat_id, int64 message_ return implicit_reply_to_message_id < message_id ? implicit_reply_to_message_id : 0; } -td::int64 Client::get_message_thread_id(const td_api::object_ptr &topic_id) { +td::int32 Client::get_forum_topic_id(const td_api::object_ptr &topic_id) { if (topic_id == nullptr) { return 0; } switch (topic_id->get_id()) { case td_api::messageTopicThread::ID: - return static_cast(topic_id.get())->message_thread_id_; + return as_client_message_id(static_cast(topic_id.get())->message_thread_id_); case td_api::messageTopicForum::ID: { auto forum_topic_id = static_cast(topic_id.get())->forum_topic_id_; if (forum_topic_id == GENERAL_FORUM_TOPIC_ID) { return 0; } - return as_tdlib_message_id(forum_topic_id); + return forum_topic_id; } case td_api::messageTopicDirectMessages::ID: return 0; diff --git a/telegram-bot-api/Client.h b/telegram-bot-api/Client.h index e87e115..2614918 100644 --- a/telegram-bot-api/Client.h +++ b/telegram-bot-api/Client.h @@ -1234,7 +1234,7 @@ class Client final : public WebhookActor::Callback { int64 get_implicit_reply_to_message_id(int64 chat_id, int64 message_id, const td_api::object_ptr &topic_id) const; - static int64 get_message_thread_id(const td_api::object_ptr &topic_id); + static int32 get_forum_topic_id(const td_api::object_ptr &topic_id); static int64 as_tdlib_message_id(int32 message_id);