mirror of
https://github.com/tdlight-team/tdlight-telegram-bot-api.git
synced 2024-11-26 22:16:51 +01:00
Support pinChatMessage for business messages.
This commit is contained in:
parent
3a53074483
commit
94aa9d390b
@ -11302,10 +11302,21 @@ td::Status Client::process_set_chat_description_query(PromisedQueryPtr &query) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
td::Status Client::process_pin_chat_message_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 chat_id = query->arg("chat_id");
|
||||||
auto message_id = get_message_id(query.get());
|
auto message_id = get_message_id(query.get());
|
||||||
auto disable_notification = to_bool(query->arg("disable_notification"));
|
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),
|
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) {
|
[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),
|
send_request(make_object<td_api::pinChatMessage>(chat_id, message_id, disable_notification, false),
|
||||||
|
Loading…
Reference in New Issue
Block a user