- fixed Song History not working anymore

This commit is contained in:
Tim Müller 2022-10-09 16:44:00 +02:00
parent 1fc3fae278
commit 5a9d978b5e
3 changed files with 10 additions and 9 deletions

@ -101,7 +101,7 @@ namespace TomatenMusic.Music
} }
_logger.LogInformation($"Skipped Track {CurrentTrack.Title} for Track {response.Track.Title}"); _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); QueuePrompt.UpdateFor(GuildId);
} }

@ -26,7 +26,7 @@ namespace TomatenMusic.Music
public TomatenMusicTrack LastTrack { get; set; } public TomatenMusicTrack LastTrack { get; set; }
public List<TomatenMusicTrack> QueueLoopList { get; private set; } public List<TomatenMusicTrack> QueueLoopList { get; private set; } = new List<TomatenMusicTrack>();
public void QueueTrack(TomatenMusicTrack track) public void QueueTrack(TomatenMusicTrack track)
{ {
@ -95,7 +95,7 @@ namespace TomatenMusic.Music
public MusicActionResponse NextTrack(bool ignoreLoop = false, bool autoplay = false) public MusicActionResponse NextTrack(bool ignoreLoop = false, bool autoplay = false)
{ {
if (LastTrack != null) if (LastTrack != null)
if (LoopType != LoopType.NONE && Queue.Count == 0 || autoplay) if (LoopType != LoopType.TRACK || (ignoreLoop && (Queue.Any() || autoplay)))
PlayedTracks = new Queue<TomatenMusicTrack>(PlayedTracks.Prepend(new TomatenMusicTrack(LastTrack.WithPosition(TimeSpan.Zero)))); PlayedTracks = new Queue<TomatenMusicTrack>(PlayedTracks.Prepend(new TomatenMusicTrack(LastTrack.WithPosition(TimeSpan.Zero))));
switch (LoopType) switch (LoopType)
@ -158,7 +158,7 @@ namespace TomatenMusic.Music
if (type == LoopType.QUEUE) if (type == LoopType.QUEUE)
{ {
QueueLoopList = new List<TomatenMusicTrack>(QueueLoopList.Prepend(LastTrack)); QueueLoopList = new List<TomatenMusicTrack>(Queue.Prepend(LastTrack));
} }
} }
} }

@ -93,15 +93,16 @@ namespace TomatenMusic.Prompt.Implementation
_ = args.Interaction.EditOriginalResponseAsync(new DiscordWebhookBuilder().WithContent("Please connect to the bots Channel to use this Interaction")); _ = args.Interaction.EditOriginalResponseAsync(new DiscordWebhookBuilder().WithContent("Please connect to the bots Channel to use this Interaction"));
return; return;
} }
try try
{ {
await Player.RewindAsync(); await Player.RewindAsync();
}catch (Exception ex) }
catch (Exception ex)
{ {
_ = args.Interaction.CreateResponseAsync( Console.WriteLine(ex);
DSharpPlus.InteractionResponseType.ChannelMessageWithSource,
new DiscordInteractionResponseBuilder()
.WithContent($"An Error occurred during this Interaction {ex.Message}"));
} }
} }
} }