removed some unnecessary task.runs
This commit is contained in:
parent
85ff050061
commit
61f0f27a0c
@ -53,30 +53,24 @@ namespace NadekoBot.Modules.Music
|
|||||||
cgb.CreateCommand("stop")
|
cgb.CreateCommand("stop")
|
||||||
.Alias("s")
|
.Alias("s")
|
||||||
.Description("Stops the music and clears the playlist. Stays in the channel.\n**Usage**: `!m 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;
|
||||||
MusicPlayer musicPlayer;
|
if (e.User.VoiceChannel == musicPlayer.PlaybackVoiceChannel)
|
||||||
if (!MusicPlayers.TryGetValue(e.Server, out musicPlayer)) return;
|
musicPlayer.Stop();
|
||||||
if (e.User.VoiceChannel == musicPlayer.PlaybackVoiceChannel)
|
|
||||||
musicPlayer.Stop();
|
|
||||||
}).ConfigureAwait(false);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
cgb.CreateCommand("destroy")
|
cgb.CreateCommand("destroy")
|
||||||
.Alias("d")
|
.Alias("d")
|
||||||
.Description("Completely stops the music and unbinds the bot from the channel. " +
|
.Description("Completely stops the music and unbinds the bot from the channel. " +
|
||||||
"(may cause weird behaviour)\n**Usage**: `!m d`")
|
"(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;
|
||||||
MusicPlayer musicPlayer;
|
if (e.User.VoiceChannel == musicPlayer.PlaybackVoiceChannel)
|
||||||
if (!MusicPlayers.TryRemove(e.Server, out musicPlayer)) return;
|
musicPlayer.Destroy();
|
||||||
if (e.User.VoiceChannel == musicPlayer.PlaybackVoiceChannel)
|
|
||||||
musicPlayer.Destroy();
|
|
||||||
}).ConfigureAwait(false);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
cgb.CreateCommand("pause")
|
cgb.CreateCommand("pause")
|
||||||
|
Loading…
Reference in New Issue
Block a user