Support editMessageReplyMarkup for business messages.

This commit is contained in:
levlam 2024-06-11 22:53:41 +03:00
parent f75e2155c1
commit 86fb9bc8b8

View File

@ -10497,6 +10497,7 @@ td::Status Client::process_edit_message_caption_query(PromisedQueryPtr &query) {
}
td::Status Client::process_edit_message_reply_markup_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());
TRY_RESULT(reply_markup, get_reply_markup(query.get(), bot_user_ids_));
@ -10513,9 +10514,26 @@ td::Status Client::process_edit_message_reply_markup_query(PromisedQueryPtr &que
} else {
resolve_reply_markup_bot_usernames(
std::move(reply_markup), std::move(query),
[this, chat_id = chat_id.str(), message_id](object_ptr<td_api::ReplyMarkup> reply_markup,
PromisedQueryPtr query) {
check_message(chat_id, message_id, false, AccessRights::Edit, "message to edit", std::move(query),
[this, business_connection_id = business_connection_id.str(), chat_id_str = chat_id.str(), message_id](
object_ptr<td_api::ReplyMarkup> reply_markup, PromisedQueryPtr query) {
if (!business_connection_id.empty()) {
auto r_chat_id = get_business_connection_chat_id(chat_id_str);
if (r_chat_id.is_error()) {
return fail_query_with_error(std::move(query), 400, r_chat_id.error().message());
}
auto chat_id = r_chat_id.move_as_ok();
return check_business_connection(
business_connection_id, std::move(query),
[this, business_connection_id, chat_id, message_id, reply_markup = std::move(reply_markup)](
const BusinessConnection *business_connection, PromisedQueryPtr query) mutable {
send_request(make_object<td_api::editBusinessMessageReplyMarkup>(business_connection_id, chat_id,
message_id, std::move(reply_markup)),
td::make_unique<TdOnReturnBusinessMessageCallback>(this, business_connection_id,
std::move(query)));
});
}
check_message(chat_id_str, message_id, false, AccessRights::Edit, "message to edit", std::move(query),
[this, reply_markup = std::move(reply_markup)](int64 chat_id, int64 message_id,
PromisedQueryPtr query) mutable {
send_request(