Add td_api::linkPreviewTypeVideoNote and td_api::linkPreviewTypeVoiceNote.

This commit is contained in:
levlam 2024-07-04 18:40:05 +03:00
parent cf8f72c07d
commit cc1861568b
2 changed files with 15 additions and 0 deletions

View File

@ -2659,6 +2659,12 @@ linkPreviewTypeVideo url:string mime_type:string video:video width:int32 height:
//@is_live_stream True, if the video chat is expected to be a live stream in a channel or a broadcast group
linkPreviewTypeVideoChat photo:chatPhoto is_live_stream:Bool = LinkPreviewType;
//@description The link is a link to a video note message @video_note The video note
linkPreviewTypeVideoNote video_note:videoNote = LinkPreviewType;
//@description The link is a link to a voice note message @voice_note The voice note
linkPreviewTypeVoiceNote voice_note:voiceNote = LinkPreviewType;
//@description The link is a link to a Web App @photo Web App photo
linkPreviewTypeWebApp photo:photo = LinkPreviewType;

View File

@ -1589,6 +1589,15 @@ td_api::object_ptr<td_api::LinkPreviewType> WebPagesManager::get_link_preview_ty
web_page->duration_, web_page->author_);
}
}
if (web_page->document_.type == Document::Type::VideoNote && web_page->type_ == "document") {
auto video_note = td_->video_notes_manager_->get_video_note_object(web_page->document_.file_id);
return td_api::make_object<td_api::linkPreviewTypeVideoNote>(std::move(video_note));
}
if (web_page->document_.type == Document::Type::VoiceNote && web_page->type_ == "document") {
auto voice_note = td_->voice_notes_manager_->get_voice_note_object(web_page->document_.file_id);
return td_api::make_object<td_api::linkPreviewTypeVoiceNote>(std::move(voice_note));
}
LOG(ERROR) << "Receive link preview of unsupported type " << web_page->type_;
return td_api::make_object<td_api::linkPreviewTypeUnsupported>();
}