From 90514e8e624e90509c39be537bc679f24b2b6108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20M=C3=BCller?= Date: Sun, 20 Mar 2022 18:45:12 +0100 Subject: [PATCH] Implemented Card https://cloud.tomatentum.net/apps/deck/#/board/19/card/229 --- TomatenMusicCore/Music/GuildPlayer.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/TomatenMusicCore/Music/GuildPlayer.cs b/TomatenMusicCore/Music/GuildPlayer.cs index b592c29..e8c54cf 100644 --- a/TomatenMusicCore/Music/GuildPlayer.cs +++ b/TomatenMusicCore/Music/GuildPlayer.cs @@ -134,7 +134,6 @@ namespace TomatenMusic.Music public async Task PlayPlaylistNowAsync(LavalinkPlaylist playlist) { - EnsureConnected(); EnsureNotDestroyed(); if (!PlayerQueue.Queue.Any()) @@ -159,8 +158,16 @@ namespace TomatenMusic.Music 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}"); await base.PlayAsync(response.Track); QueuePrompt.UpdateFor(GuildId); @@ -168,6 +175,8 @@ namespace TomatenMusic.Music public async Task SkipAsync() { + EnsureNotDestroyed(); + EnsureConnected(); MusicActionResponse response = PlayerQueue.NextTrack(true); _logger.LogInformation($"Skipped Track {CurrentTrack.Title} for Track {response.Track.Title}");