From 5a9d978b5e6a3ddafbca14a4d192f0cb4b307b67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20M=C3=BCller?= Date: Sun, 9 Oct 2022 16:44:00 +0200 Subject: [PATCH] - fixed Song History not working anymore --- TomatenMusicCore/Music/GuildPlayer.cs | 2 +- TomatenMusicCore/Music/PlayerQueue.cs | 6 +++--- TomatenMusicCore/Prompt/Implementation/QueuePrompt.cs | 11 ++++++----- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/TomatenMusicCore/Music/GuildPlayer.cs b/TomatenMusicCore/Music/GuildPlayer.cs index d2db34a..1b6e22a 100644 --- a/TomatenMusicCore/Music/GuildPlayer.cs +++ b/TomatenMusicCore/Music/GuildPlayer.cs @@ -101,7 +101,7 @@ namespace TomatenMusic.Music } _logger.LogInformation($"Skipped Track {CurrentTrack.Title} for Track {response.Track.Title}"); - await base.PlayAsync(response.Track); + await PlayNowAsync(response.Track, withoutQueuePrepend: true); QueuePrompt.UpdateFor(GuildId); } diff --git a/TomatenMusicCore/Music/PlayerQueue.cs b/TomatenMusicCore/Music/PlayerQueue.cs index 0a3d646..8cff94a 100644 --- a/TomatenMusicCore/Music/PlayerQueue.cs +++ b/TomatenMusicCore/Music/PlayerQueue.cs @@ -26,7 +26,7 @@ namespace TomatenMusic.Music public TomatenMusicTrack LastTrack { get; set; } - public List QueueLoopList { get; private set; } + public List QueueLoopList { get; private set; } = new List(); public void QueueTrack(TomatenMusicTrack track) { @@ -95,7 +95,7 @@ namespace TomatenMusic.Music public MusicActionResponse NextTrack(bool ignoreLoop = false, bool autoplay = false) { if (LastTrack != null) - if (LoopType != LoopType.NONE && Queue.Count == 0 || autoplay) + if (LoopType != LoopType.TRACK || (ignoreLoop && (Queue.Any() || autoplay))) PlayedTracks = new Queue(PlayedTracks.Prepend(new TomatenMusicTrack(LastTrack.WithPosition(TimeSpan.Zero)))); switch (LoopType) @@ -158,7 +158,7 @@ namespace TomatenMusic.Music if (type == LoopType.QUEUE) { - QueueLoopList = new List(QueueLoopList.Prepend(LastTrack)); + QueueLoopList = new List(Queue.Prepend(LastTrack)); } } } diff --git a/TomatenMusicCore/Prompt/Implementation/QueuePrompt.cs b/TomatenMusicCore/Prompt/Implementation/QueuePrompt.cs index 0677813..014caff 100644 --- a/TomatenMusicCore/Prompt/Implementation/QueuePrompt.cs +++ b/TomatenMusicCore/Prompt/Implementation/QueuePrompt.cs @@ -93,15 +93,16 @@ namespace TomatenMusic.Prompt.Implementation _ = args.Interaction.EditOriginalResponseAsync(new DiscordWebhookBuilder().WithContent("Please connect to the bots Channel to use this Interaction")); return; } + + try { await Player.RewindAsync(); - }catch (Exception ex) + } + catch (Exception ex) { - _ = args.Interaction.CreateResponseAsync( - DSharpPlus.InteractionResponseType.ChannelMessageWithSource, - new DiscordInteractionResponseBuilder() - .WithContent($"An Error occurred during this Interaction {ex.Message}")); + Console.WriteLine(ex); + } } }