diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 5affa59fb..2bda72e04 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -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; diff --git a/td/telegram/WebPagesManager.cpp b/td/telegram/WebPagesManager.cpp index 2e7095f8c..a6a00292d 100644 --- a/td/telegram/WebPagesManager.cpp +++ b/td/telegram/WebPagesManager.cpp @@ -1589,6 +1589,15 @@ td_api::object_ptr 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(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(std::move(voice_note)); + } + LOG(ERROR) << "Receive link preview of unsupported type " << web_page->type_; return td_api::make_object(); }