From 94aa9d390bc254d5b5e0671b27199f316cc06188 Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 30 Jul 2024 13:05:42 +0300 Subject: [PATCH] Support pinChatMessage for business messages. --- telegram-bot-api/Client.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index 36007ec..5badda4 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -11302,10 +11302,21 @@ td::Status Client::process_set_chat_description_query(PromisedQueryPtr &query) { } td::Status Client::process_pin_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()); auto disable_notification = to_bool(query->arg("disable_notification")); + 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, true), + td::make_unique(std::move(query))); + }); + return td::Status::OK(); + } check_message(chat_id, message_id, false, AccessRights::Write, "message to pin", std::move(query), [this, disable_notification](int64 chat_id, int64 message_id, PromisedQueryPtr query) { send_request(make_object(chat_id, message_id, disable_notification, false),