Fixed .play when queue is stopped. .play X will now also unstop the player

This commit is contained in:
Master Kwoth 2017-07-11 19:52:10 +02:00
parent 8f90410e2d
commit 0e4728d9c9
2 changed files with 19 additions and 13 deletions

View File

@ -28,6 +28,7 @@ namespace NadekoBot.Modules.Administration
_muteService = muteService;
}
//todo move to service
private async Task<PunishmentAction?> InternalWarn(IGuild guild, ulong userId, string modName, string reason)
{
if (string.IsNullOrWhiteSpace(reason))

View File

@ -339,18 +339,6 @@ namespace NadekoBot.Services.Music
}
}
public void SetIndex(int index)
{
if (index < 0)
throw new ArgumentOutOfRangeException(nameof(index));
lock (locker)
{
Queue.CurrentIndex = index;
manualIndex = true;
CancelCurrentSong();
}
}
private async Task<IAudioClient> GetAudioClient(bool reconnect = false)
{
if (_audioClient == null ||
@ -409,6 +397,21 @@ namespace NadekoBot.Services.Music
}
}
public void SetIndex(int index)
{
if (index < 0)
throw new ArgumentOutOfRangeException(nameof(index));
lock (locker)
{
if (Exited)
return;
Queue.CurrentIndex = index;
manualIndex = true;
Stopped = false;
CancelCurrentSong();
}
}
public void Next(int skipCount = 1)
{
lock (locker)
@ -420,9 +423,11 @@ namespace NadekoBot.Services.Music
// It's a bit weird, but that's the least annoying solution
if (!Stopped)
Queue.Next(skipCount - 1);
else
Queue.CurrentIndex = 0;
Stopped = false;
Unpause();
CancelCurrentSong();
Unpause();
}
}