Implemented Card

https://cloud.tomatentum.net/apps/deck/#/board/19/card/229
This commit is contained in:
Tim Müller 2022-03-20 18:45:12 +01:00
parent 3bdb592671
commit 90514e8e62

@ -134,7 +134,6 @@ namespace TomatenMusic.Music
public async Task PlayPlaylistNowAsync(LavalinkPlaylist playlist) public async Task PlayPlaylistNowAsync(LavalinkPlaylist playlist)
{ {
EnsureConnected(); EnsureConnected();
EnsureNotDestroyed(); EnsureNotDestroyed();
if (!PlayerQueue.Queue.Any()) if (!PlayerQueue.Queue.Any())
@ -159,8 +158,16 @@ namespace TomatenMusic.Music
public async Task RewindAsync() public async Task RewindAsync()
{ {
MusicActionResponse response = PlayerQueue.Rewind(); EnsureNotDestroyed();
EnsureConnected();
if (Position.Position.Seconds < 4)
{
await ReplayAsync();
return;
}
MusicActionResponse response = PlayerQueue.Rewind();
_logger.LogInformation($"Rewinded Track {CurrentTrack.Title} for Track {response.Track.Title}"); _logger.LogInformation($"Rewinded Track {CurrentTrack.Title} for Track {response.Track.Title}");
await base.PlayAsync(response.Track); await base.PlayAsync(response.Track);
QueuePrompt.UpdateFor(GuildId); QueuePrompt.UpdateFor(GuildId);
@ -168,6 +175,8 @@ namespace TomatenMusic.Music
public async Task SkipAsync() public async Task SkipAsync()
{ {
EnsureNotDestroyed();
EnsureConnected();
MusicActionResponse response = PlayerQueue.NextTrack(true); MusicActionResponse response = PlayerQueue.NextTrack(true);
_logger.LogInformation($"Skipped Track {CurrentTrack.Title} for Track {response.Track.Title}"); _logger.LogInformation($"Skipped Track {CurrentTrack.Title} for Track {response.Track.Title}");