Support messagePaidMedia in inputInvoiceMessage.

This commit is contained in:
levlam 2024-06-28 16:27:20 +03:00
parent 1ab9b685c4
commit fa49c93624
2 changed files with 6 additions and 3 deletions

View File

@ -2789,7 +2789,7 @@ paymentReceipt product_info:productInfo date:int32 seller_bot_user_id:int53 type
//@class InputInvoice @description Describes an invoice to process
//@description An invoice from a message of the type messageInvoice @chat_id Chat identifier of the message @message_id Message identifier
//@description An invoice from a message of the type messageInvoice or paid media purchase from messagePaidMedia @chat_id Chat identifier of the message @message_id Message identifier
inputInvoiceMessage chat_id:int53 message_id:int53 = InputInvoice;
//@description An invoice from a link of the type internalLinkTypeInvoice @name Name of the invoice

View File

@ -38281,7 +38281,8 @@ Result<ServerMessageId> MessagesManager::get_invoice_message_id(MessageFullId me
if (m == nullptr) {
return Status::Error(400, "Message not found");
}
if (m->content->get_type() != MessageContentType::Invoice) {
auto content_type = m->content->get_type();
if (content_type != MessageContentType::Invoice && content_type != MessageContentType::PaidMedia) {
return Status::Error(400, "Message has no invoice");
}
if (m->message_id.is_scheduled()) {
@ -38293,7 +38294,9 @@ Result<ServerMessageId> MessagesManager::get_invoice_message_id(MessageFullId me
if (m->reply_markup == nullptr || m->reply_markup->inline_keyboard.empty() ||
m->reply_markup->inline_keyboard[0].empty() ||
m->reply_markup->inline_keyboard[0][0].type != InlineKeyboardButton::Type::Buy) {
return Status::Error(400, "Message has no Pay button");
if (content_type != MessageContentType::PaidMedia) {
return Status::Error(400, "Message has no Pay button");
}
}
return m->message_id.get_server_message_id();