From 70c03cf22f9ec9fb6eccfbdcde365e3e9dca48e0 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 15 May 2024 23:12:47 +0300 Subject: [PATCH] Check that parameter show_caption_above_media is the same for all media album messages. --- td/generate/scheme/td_api.tl | 6 +++--- td/telegram/MessageContent.cpp | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 34f8004d8..0a54b719b 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -8093,7 +8093,7 @@ sendMessage chat_id:int53 message_thread_id:int53 reply_to:InputMessageReplyTo o //@message_thread_id If not 0, the message thread identifier in which the messages will be sent //@reply_to Information about the message or story to be replied; pass null if none //@options Options to be used to send the messages; pass null to use default options -//@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album +//@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album. All messages must have the same value of show_caption_above_media sendMessageAlbum chat_id:int53 message_thread_id:int53 reply_to:InputMessageReplyTo options:messageSendOptions input_message_contents:vector = Messages; //@description Invites a bot to a chat (if it is not yet a member) and sends it the /start command; requires can_invite_users member right. Bots can't be invited to a private chat other than the chat with the bot. @@ -8256,7 +8256,7 @@ sendBusinessMessage business_connection_id:string chat_id:int53 reply_to:InputMe //@disable_notification Pass true to disable notification for the message //@protect_content Pass true if the content of the message must be protected from forwarding and saving //@effect_id Identifier of the effect to apply to the message -//@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album +//@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album. All messages must have the same value of show_caption_above_media sendBusinessMessageAlbum business_connection_id:string chat_id:int53 reply_to:InputMessageReplyTo disable_notification:Bool protect_content:Bool effect_id:int64 input_message_contents:vector = BusinessMessages; @@ -8304,7 +8304,7 @@ addQuickReplyShortcutInlineQueryResultMessage shortcut_name:string reply_to_mess //-Documents and audio files can be only grouped in an album with messages of the same type. Returns sent messages //@shortcut_name Name of the target shortcut //@reply_to_message_id Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none -//@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album +//@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album. All messages must have the same value of show_caption_above_media addQuickReplyShortcutMessageAlbum shortcut_name:string reply_to_message_id:int53 input_message_contents:vector = QuickReplyMessages; //@description Readds quick reply messages which failed to add. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp index 78db83793..cc78b68d9 100644 --- a/td/telegram/MessageContent.cpp +++ b/td/telegram/MessageContent.cpp @@ -3066,6 +3066,9 @@ Status check_message_group_message_contents(const vector &m if (!is_allowed_media_group_content(message_content_type)) { return Status::Error(400, "Invalid message content type"); } + if (message_content.invert_media != message_contents[0].invert_media) { + return Status::Error(400, "Parameter show_caption_above_media must be the same for all messages"); + } message_content_types.insert(message_content_type); } if (message_content_types.size() > 1) {