From 85dbbd8bfcb701194d8112bb966876fdd131991a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20M=C3=BCller?= Date: Thu, 31 Mar 2022 18:37:35 +0200 Subject: [PATCH] fix file playback --- TomatenMusicCore/Music/Entitites/FullTrackContext.cs | 2 +- TomatenMusicCore/Util/Common.cs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/TomatenMusicCore/Music/Entitites/FullTrackContext.cs b/TomatenMusicCore/Music/Entitites/FullTrackContext.cs index 03e6b19..4250914 100644 --- a/TomatenMusicCore/Music/Entitites/FullTrackContext.cs +++ b/TomatenMusicCore/Music/Entitites/FullTrackContext.cs @@ -20,7 +20,7 @@ namespace TomatenMusic.Music.Entitites public IEnumerable YoutubeTags { get; set; } public ulong YoutubeViews { get; set; } public ulong YoutubeLikes { get; set; } - public Uri YoutubeThumbnail { get; set; } + public Uri? YoutubeThumbnail { get; set; } = null; public DateTime YoutubeUploadDate { get; set; } // // Summary: diff --git a/TomatenMusicCore/Util/Common.cs b/TomatenMusicCore/Util/Common.cs index 050d5cc..478e9af 100644 --- a/TomatenMusicCore/Util/Common.cs +++ b/TomatenMusicCore/Util/Common.cs @@ -32,10 +32,12 @@ namespace TomatenMusic.Util DiscordEmbedBuilder builder = new DiscordEmbedBuilder() .WithTitle(track.Title) .WithUrl(track.Source) - .WithImageUrl(context.YoutubeThumbnail) .WithDescription(context.YoutubeDescription) .AddField("Length", Common.GetTimestamp(track.Duration), true); + if (context.YoutubeThumbnail != null) + builder.WithImageUrl(context.YoutubeThumbnail); + if (context.IsFile) { builder.WithAuthor(track.Author);