Support pinChatMessage for business messages.

This commit is contained in:
levlam 2024-07-30 13:05:42 +03:00
parent 3a53074483
commit 94aa9d390b

View File

@ -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<td_api::setBusinessMessageIsPinned>(business_connection->id_, chat_id, message_id, true),
td::make_unique<TdOnOkQueryCallback>(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<td_api::pinChatMessage>(chat_id, message_id, disable_notification, false),