summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--DiscoBot/Commands/Voice.cs12
1 files changed, 10 insertions, 2 deletions
diff --git a/DiscoBot/Commands/Voice.cs b/DiscoBot/Commands/Voice.cs
index 3391452..7b28965 100644
--- a/DiscoBot/Commands/Voice.cs
+++ b/DiscoBot/Commands/Voice.cs
@@ -19,12 +19,19 @@
public static async Task SendAsync(string path, int volume = 256)
{
+ if (Client == null)
+ {
+ throw new NullReferenceException("Bot befindet sich nicht in einem Sprachchannel");
+ }
+
// Create FFmpeg using the previous example
- var ffmpeg = CreateStream(path, volume);
+ var ffmpeg = CreateStream(path, volume);
var output = ffmpeg.StandardOutput.BaseStream;
+
var discord = Client.CreatePCMStream(AudioApplication.Music);
await output.CopyToAsync(discord);
await discord.FlushAsync();
+
}
[Command("join", RunMode = RunMode.Async)]
@@ -51,6 +58,7 @@
{
if (Client != null)
{
+ await SoundEffects.Play(Sound.Nooo);
await Client.StopAsync();
Client = null;
}
@@ -71,7 +79,7 @@
soundList.Add((Sound)sound);
}
- var sc = new SpellCorrect();
+ var sc = new SpellCorrect();
var tSound = soundList.OrderBy(x => sc.Compare(path, x.ToString())).First();