From 61f0f27a0cd2805c797473803e497a75c69f40f5 Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Thu, 30 Jun 2016 04:42:54 +0200 Subject: [PATCH] removed some unnecessary task.runs --- NadekoBot/Modules/Music/MusicModule.cs | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/NadekoBot/Modules/Music/MusicModule.cs b/NadekoBot/Modules/Music/MusicModule.cs index ef482532..2d0dbd86 100644 --- a/NadekoBot/Modules/Music/MusicModule.cs +++ b/NadekoBot/Modules/Music/MusicModule.cs @@ -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 => + .Do(e => { - await Task.Run(() => - { - MusicPlayer musicPlayer; - if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer)) return; - if (e.User.VoiceChannel == musicPlayer.PlaybackVoiceChannel) - musicPlayer.Stop(); - }).ConfigureAwait(false); + MusicPlayer musicPlayer; + if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer)) return; + if (e.User.VoiceChannel == musicPlayer.PlaybackVoiceChannel) + musicPlayer.Stop(); }); 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 => + .Do(e => { - await Task.Run(() => - { - MusicPlayer musicPlayer; - if (!MusicPlayers.TryRemove(e.Server, out musicPlayer)) return; - if (e.User.VoiceChannel == musicPlayer.PlaybackVoiceChannel) - musicPlayer.Destroy(); - }).ConfigureAwait(false); + MusicPlayer musicPlayer; + if (!MusicPlayers.TryRemove(e.Server, out musicPlayer)) return; + if (e.User.VoiceChannel == musicPlayer.PlaybackVoiceChannel) + musicPlayer.Destroy(); }); cgb.CreateCommand("pause")