removed some unnecessary task.runs

This commit is contained in:
Master Kwoth 2016-06-30 04:42:54 +02:00
parent 85ff050061
commit 61f0f27a0c

View File

@ -53,30 +53,24 @@ namespace NadekoBot.Modules.Music
cgb.CreateCommand("stop")
.Alias("s")
.Description("Stops the music and clears the playlist. Stays in the channel.\n**Usage**: `!m s`")
.Do(async e =>
{
await Task.Run(() =>
.Do(e =>
{
MusicPlayer musicPlayer;
if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer)) return;
if (e.User.VoiceChannel == musicPlayer.PlaybackVoiceChannel)
musicPlayer.Stop();
}).ConfigureAwait(false);
});
cgb.CreateCommand("destroy")
.Alias("d")
.Description("Completely stops the music and unbinds the bot from the channel. " +
"(may cause weird behaviour)\n**Usage**: `!m d`")
.Do(async e =>
{
await Task.Run(() =>
.Do(e =>
{
MusicPlayer musicPlayer;
if (!MusicPlayers.TryRemove(e.Server, out musicPlayer)) return;
if (e.User.VoiceChannel == musicPlayer.PlaybackVoiceChannel)
musicPlayer.Destroy();
}).ConfigureAwait(false);
});
cgb.CreateCommand("pause")