From 16de9313b0d2960b702811263ba70998bcb553da Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 30 Jul 2024 13:10:46 +0300 Subject: [PATCH] Support unpinChatMessage for business messages. --- telegram-bot-api/Client.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index 5badda4..d708db7 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -11326,9 +11326,21 @@ td::Status Client::process_pin_chat_message_query(PromisedQueryPtr &query) { } td::Status Client::process_unpin_chat_message_query(PromisedQueryPtr &query) { + auto business_connection_id = query->arg("business_connection_id"); auto chat_id = query->arg("chat_id"); auto message_id = get_message_id(query.get()); + if (!business_connection_id.empty()) { + check_business_connection_chat_id( + business_connection_id.str(), chat_id.str(), std::move(query), + [this, message_id](const BusinessConnection *business_connection, int64 chat_id, PromisedQueryPtr query) { + send_request( + make_object(business_connection->id_, chat_id, message_id, false), + td::make_unique(std::move(query))); + }); + return td::Status::OK(); + } + if (message_id == 0) { check_chat(chat_id, AccessRights::Write, std::move(query), [this](int64 chat_id, PromisedQueryPtr query) { send_request(make_object(chat_id),