This commit is contained in:
Kwoth 2016-10-16 01:37:29 +02:00
parent 70e5337d97
commit 966b091c95
2 changed files with 5 additions and 3 deletions

View File

@ -251,9 +251,10 @@ namespace NadekoBot.Modules.Music.Classes
RepeatSong = false;
Destroyed = true;
playlist.Clear();
try { await audioClient.DisconnectAsync(); } catch { }
if (!SongCancelSource.IsCancellationRequested)
SongCancelSource.Cancel();
await audioClient.DisconnectAsync();
});
}

View File

@ -72,9 +72,10 @@ namespace NadekoBot.Modules.Music
var channel = (ITextChannel)umsg.Channel;
MusicPlayer musicPlayer;
if (!MusicPlayers.TryRemove(channel.Guild.Id, out musicPlayer)) return Task.CompletedTask;
if (!MusicPlayers.TryGetValue(channel.Guild.Id, out musicPlayer)) return Task.CompletedTask;
if (((IGuildUser)umsg.Author).VoiceChannel == musicPlayer.PlaybackVoiceChannel)
musicPlayer.Destroy();
if(MusicPlayers.TryRemove(channel.Guild.Id, out musicPlayer))
musicPlayer.Destroy();
return Task.CompletedTask;
}