Move caption out of ExtendedMedia.
This commit is contained in:
parent
babcde8c76
commit
5cb008b58d
@ -2790,17 +2790,16 @@ inputInvoiceTelegram purpose:TelegramPaymentPurpose = InputInvoice;
|
||||
//@height Media height; 0 if unknown
|
||||
//@duration Media duration, in seconds; 0 if unknown
|
||||
//@minithumbnail Media minithumbnail; may be null
|
||||
//@caption Media caption
|
||||
messageExtendedMediaPreview width:int32 height:int32 duration:int32 minithumbnail:minithumbnail caption:formattedText = MessageExtendedMedia;
|
||||
messageExtendedMediaPreview width:int32 height:int32 duration:int32 minithumbnail:minithumbnail = MessageExtendedMedia;
|
||||
|
||||
//@description The media is a photo @photo The photo @caption Photo caption
|
||||
messageExtendedMediaPhoto photo:photo caption:formattedText = MessageExtendedMedia;
|
||||
//@description The media is a photo @photo The photo
|
||||
messageExtendedMediaPhoto photo:photo = MessageExtendedMedia;
|
||||
|
||||
//@description The media is a video @video The video @caption Photo caption
|
||||
messageExtendedMediaVideo video:video caption:formattedText = MessageExtendedMedia;
|
||||
//@description The media is a video @video The video
|
||||
messageExtendedMediaVideo video:video = MessageExtendedMedia;
|
||||
|
||||
//@description The media is unsupported @caption Media caption
|
||||
messageExtendedMediaUnsupported caption:formattedText = MessageExtendedMedia;
|
||||
//@description The media is unsupported
|
||||
messageExtendedMediaUnsupported = MessageExtendedMedia;
|
||||
|
||||
|
||||
//@description Describes parameters of a Telegram Premium giveaway
|
||||
@ -3200,8 +3199,9 @@ messageStory story_sender_chat_id:int53 story_id:int32 via_mention:Bool = Messag
|
||||
//@is_test True, if the invoice is a test invoice
|
||||
//@need_shipping_address True, if the shipping address must be specified
|
||||
//@receipt_message_id The identifier of the message with the receipt, after the product has been purchased
|
||||
//@extended_media Extended media attached to the invoice; may be null
|
||||
messageInvoice product_info:productInfo currency:string total_amount:int53 start_parameter:string is_test:Bool need_shipping_address:Bool receipt_message_id:int53 extended_media:MessageExtendedMedia = MessageContent;
|
||||
//@extended_media Extended media attached to the invoice; may be null if none
|
||||
//@extended_media_caption Extended media caption; may be null if none
|
||||
messageInvoice product_info:productInfo currency:string total_amount:int53 start_parameter:string is_test:Bool need_shipping_address:Bool receipt_message_id:int53 extended_media:MessageExtendedMedia extended_media_caption:formattedText = MessageContent;
|
||||
|
||||
//@description A message with information about an ended call @is_video True, if the call was a video call @discard_reason Reason why the call was discarded @duration Call duration, in seconds
|
||||
messageCall is_video:Bool discard_reason:CallDiscardReason duration:int32 = MessageContent;
|
||||
|
@ -242,7 +242,8 @@ tl_object_ptr<td_api::messageInvoice> InputInvoice::get_message_invoice_object(T
|
||||
return make_tl_object<td_api::messageInvoice>(
|
||||
get_product_info_object(td, title_, description_, photo_), invoice_.currency_, total_amount_, start_parameter_,
|
||||
invoice_.is_test_, invoice_.need_shipping_address_, receipt_message_id_.get(),
|
||||
extended_media_.get_message_extended_media_object(td, skip_bot_commands, max_media_timestamp));
|
||||
extended_media_.get_message_extended_media_object(td),
|
||||
extended_media_.get_caption_object(skip_bot_commands, max_media_timestamp));
|
||||
}
|
||||
|
||||
tl_object_ptr<telegram_api::invoice> InputInvoice::Invoice::get_input_invoice() const {
|
||||
|
@ -152,34 +152,39 @@ bool MessageExtendedMedia::update_to(Td *td,
|
||||
return false;
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::MessageExtendedMedia> MessageExtendedMedia::get_message_extended_media_object(
|
||||
Td *td, bool skip_bot_commands, int32 max_media_timestamp) const {
|
||||
td_api::object_ptr<td_api::MessageExtendedMedia> MessageExtendedMedia::get_message_extended_media_object(Td *td) const {
|
||||
if (type_ == Type::Empty) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto caption = get_formatted_text_object(caption_, skip_bot_commands, max_media_timestamp);
|
||||
switch (type_) {
|
||||
case Type::Unsupported:
|
||||
return td_api::make_object<td_api::messageExtendedMediaUnsupported>(std::move(caption));
|
||||
return td_api::make_object<td_api::messageExtendedMediaUnsupported>();
|
||||
case Type::Preview:
|
||||
return td_api::make_object<td_api::messageExtendedMediaPreview>(dimensions_.width, dimensions_.height, duration_,
|
||||
get_minithumbnail_object(minithumbnail_),
|
||||
std::move(caption));
|
||||
get_minithumbnail_object(minithumbnail_));
|
||||
case Type::Photo: {
|
||||
auto photo = get_photo_object(td->file_manager_.get(), photo_);
|
||||
CHECK(photo != nullptr);
|
||||
return td_api::make_object<td_api::messageExtendedMediaPhoto>(std::move(photo), std::move(caption));
|
||||
return td_api::make_object<td_api::messageExtendedMediaPhoto>(std::move(photo));
|
||||
}
|
||||
case Type::Video:
|
||||
return td_api::make_object<td_api::messageExtendedMediaVideo>(
|
||||
td->videos_manager_->get_video_object(video_file_id_), std::move(caption));
|
||||
td->videos_manager_->get_video_object(video_file_id_));
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::formattedText> MessageExtendedMedia::get_caption_object(bool skip_bot_commands,
|
||||
int32 max_media_timestamp) const {
|
||||
if (type_ == Type::Empty) {
|
||||
return nullptr;
|
||||
}
|
||||
return get_formatted_text_object(caption_, skip_bot_commands, max_media_timestamp);
|
||||
}
|
||||
|
||||
void MessageExtendedMedia::append_file_ids(const Td *td, vector<FileId> &file_ids) const {
|
||||
switch (type_) {
|
||||
case Type::Empty:
|
||||
|
@ -67,8 +67,9 @@ class MessageExtendedMedia {
|
||||
bool update_to(Td *td, telegram_api::object_ptr<telegram_api::MessageExtendedMedia> extended_media_ptr,
|
||||
DialogId owner_dialog_id);
|
||||
|
||||
td_api::object_ptr<td_api::MessageExtendedMedia> get_message_extended_media_object(Td *td, bool skip_bot_commands,
|
||||
int32 max_media_timestamp) const;
|
||||
td_api::object_ptr<td_api::MessageExtendedMedia> get_message_extended_media_object(Td *td) const;
|
||||
|
||||
td_api::object_ptr<td_api::formattedText> get_caption_object(bool skip_bot_commands, int32 max_media_timestamp) const;
|
||||
|
||||
void append_file_ids(const Td *td, vector<FileId> &file_ids) const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user