Fixed removed song message

This commit is contained in:
Kwoth 2017-01-04 22:08:25 +01:00
parent ce0532335d
commit 3bcd4c2374

View File

@ -137,7 +137,7 @@ namespace NadekoBot.Modules.Music.Classes
var index = playlist.IndexOf(CurrentSong); var index = playlist.IndexOf(CurrentSong);
if (index != -1) if (index != -1)
RemoveSongAt(index); RemoveSongAt(index, true);
OnStarted(this, CurrentSong); OnStarted(this, CurrentSong);
await CurrentSong.Play(audioClient, cancelToken); await CurrentSong.Play(audioClient, cancelToken);
@ -273,14 +273,14 @@ namespace NadekoBot.Modules.Music.Classes
}); });
} }
public void RemoveSongAt(int index) public void RemoveSongAt(int index, bool silent = false)
{ {
actionQueue.Enqueue(() => actionQueue.Enqueue(() =>
{ {
if (index < 0 || index >= playlist.Count) if (index < 0 || index >= playlist.Count)
return; return;
var song = playlist.ElementAtOrDefault(index); var song = playlist.ElementAtOrDefault(index);
if (playlist.Remove(song)) if (playlist.Remove(song) && !silent)
{ {
SongRemoved(song); SongRemoved(song);
} }