summaryrefslogtreecommitdiff
path: root/DiscoBot
diff options
context:
space:
mode:
authorTrueDoctor <d-kobert@web.de>2018-04-09 15:28:37 +0200
committerTrueDoctor <d-kobert@web.de>2018-04-09 15:28:37 +0200
commit1069a9cb648429682fc59cdb6dbd3e8610e188ba (patch)
tree334fa26b578039fd5198574e75a87f87a4ed922a /DiscoBot
parent5cb8346a6a3ccc55295c00ac333e410629ff7c42 (diff)
preveted Bot from trying to play Misuc before joining a channel
Diffstat (limited to 'DiscoBot')
-rw-r--r--DiscoBot/Commands/Voice.cs11
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)