Add td_api::editBusinessMessageReplyMarkup.

This commit is contained in:
levlam 2024-06-11 14:24:31 +03:00
parent fe29121452
commit 8ea591c338
5 changed files with 36 additions and 0 deletions

View File

@ -8477,6 +8477,13 @@ editBusinessMessageMedia business_connection_id:string chat_id:int53 message_id:
//@show_caption_above_media Pass true to show the caption above the media; otherwise, caption will be shown below the media. Can be true only for animation, photo, and video messages
editBusinessMessageCaption business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup caption:formattedText show_caption_above_media:Bool = BusinessMessage;
//@description Edits the reply markup of a message sent on behalf of a business account; for bots only
//@business_connection_id Unique identifier of business connection on behalf of which the message was sent
//@chat_id The chat the message belongs to
//@message_id Identifier of the message
//@reply_markup The new message reply markup; pass null if none
editBusinessMessageReplyMarkup business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = BusinessMessage;
//@description Checks validness of a name for a quick reply shortcut. Can be called synchronously @name The name of the shortcut; 1-32 characters
checkQuickReplyShortcutName name:string = Ok;

View File

@ -1315,6 +1315,21 @@ void BusinessConnectionManager::edit_business_message_caption(
nullptr, invert_media, get_input_reply_markup(td_->user_manager_.get(), new_reply_markup));
}
void BusinessConnectionManager::edit_business_message_reply_markup(
BusinessConnectionId business_connection_id, DialogId dialog_id, MessageId message_id,
td_api::object_ptr<td_api::ReplyMarkup> &&reply_markup,
Promise<td_api::object_ptr<td_api::businessMessage>> &&promise) {
TRY_STATUS_PROMISE(promise, check_business_connection(business_connection_id, dialog_id));
TRY_STATUS_PROMISE(promise, check_business_message_id(message_id));
TRY_RESULT_PROMISE(promise, new_reply_markup,
get_reply_markup(std::move(reply_markup), td_->auth_manager_->is_bot(), true, false, true));
td_->create_handler<EditBusinessMessageQuery>(std::move(promise))
->send(0, business_connection_id, dialog_id, message_id, string(),
vector<telegram_api::object_ptr<telegram_api::MessageEntity>>(), nullptr, false /*ignored*/,
get_input_reply_markup(td_->user_manager_.get(), new_reply_markup));
}
td_api::object_ptr<td_api::updateBusinessConnection> BusinessConnectionManager::get_update_business_connection(
const BusinessConnection *connection) const {
return td_api::make_object<td_api::updateBusinessConnection>(connection->get_business_connection_object(td_));

View File

@ -95,6 +95,10 @@ class BusinessConnectionManager final : public Actor {
td_api::object_ptr<td_api::formattedText> &&input_caption, bool invert_media,
Promise<td_api::object_ptr<td_api::businessMessage>> &&promise);
void edit_business_message_reply_markup(BusinessConnectionId business_connection_id, DialogId dialog_id,
MessageId message_id, td_api::object_ptr<td_api::ReplyMarkup> &&reply_markup,
Promise<td_api::object_ptr<td_api::businessMessage>> &&promise);
void get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const;
private:

View File

@ -5841,6 +5841,14 @@ void Td::on_request(uint64 id, td_api::editBusinessMessageCaption &request) {
request.show_caption_above_media_, std::move(promise));
}
void Td::on_request(uint64 id, td_api::editBusinessMessageReplyMarkup &request) {
CHECK_IS_BOT();
CREATE_REQUEST_PROMISE();
business_connection_manager_->edit_business_message_reply_markup(
BusinessConnectionId(std::move(request.business_connection_id_)), DialogId(request.chat_id_),
MessageId(request.message_id_), std::move(request.reply_markup_), std::move(promise));
}
void Td::on_request(uint64 id, const td_api::loadQuickReplyShortcuts &request) {
CHECK_IS_USER();
CREATE_OK_REQUEST_PROMISE();

View File

@ -924,6 +924,8 @@ class Td final : public Actor {
void on_request(uint64 id, td_api::editBusinessMessageCaption &request);
void on_request(uint64 id, td_api::editBusinessMessageReplyMarkup &request);
void on_request(uint64 id, const td_api::loadQuickReplyShortcuts &request);
void on_request(uint64 id, const td_api::setQuickReplyShortcutName &request);