diff options
author | TrueDoctor <d-kobert@web.de> | 2018-04-09 15:28:37 +0200 |
---|---|---|
committer | TrueDoctor <d-kobert@web.de> | 2018-04-09 15:28:37 +0200 |
commit | 1069a9cb648429682fc59cdb6dbd3e8610e188ba (patch) | |
tree | 334fa26b578039fd5198574e75a87f87a4ed922a /DiscoBot/Commands/Voice.cs | |
parent | 5cb8346a6a3ccc55295c00ac333e410629ff7c42 (diff) |
preveted Bot from trying to play Misuc before joining a channel
Diffstat (limited to 'DiscoBot/Commands/Voice.cs')
-rw-r--r-- | DiscoBot/Commands/Voice.cs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/DiscoBot/Commands/Voice.cs b/DiscoBot/Commands/Voice.cs index 02210e8..772d807 100644 --- a/DiscoBot/Commands/Voice.cs +++ b/DiscoBot/Commands/Voice.cs @@ -30,16 +30,19 @@ } [Command("leave", RunMode = RunMode.Async)] - public Task LeaveChannelAsync(IVoiceChannel channel = null) + public async Task LeaveChannelAsync(IVoiceChannel channel = null) { - // For the next step with transmitting audio, you would want to pass this Audio Client in to a service. - return Client.StopAsync(); + if (Client != null) + { + await Client.StopAsync(); + Client = null; + } } [Command("play")] public Task PlayAudioAsync(string path) { - return SendAsync(path); + return Client == null ? this.Context.Channel.SendMessageAsync("Erst Joinen!") : SendAsync(path); } private static Process CreateStream(string path) |