Closed KodyPrograms closed 8 years ago
Responding to actual voice being sent by another user would require voice recognition software. There's events for someone joining the voice room and also another event for when they start speaking. Though, I can't remember exact names off of the top of my head.
Yeah i get that now, but how would I set the mic to use in dicord? Like how would it acutally come from the bots mic.
Check this out for sending voice: https://github.com/Luigifan/DiscordSharp/blob/master/DiscordSharpTestApplication/Modules/Voice.cs#L27
That'll do it. Now I jut need to find out how to put the bot in a certain channel.
Hey Kody, you've been asking the same questions as me (I'm also starting to make my bot). Add me on discord, we can help each other out. Discord Tag: Ivanb7#0928
Actually now that voice thing doesn't seem to send through discord.
Here's a little code I tried and it didn't quite work. Any help?
ss is my SpeechSynthensis.
public static void Speak(string toSay)
{
DiscordVoiceClient vc = client.GetVoiceClient();
try
{
int ms = vc.VoiceConfig.FrameLengthMs;
int channels = vc.VoiceConfig.Channels;
vc.SetSpeaking(true);
using (var stream = new MemoryStream())
{
ss.SetOutputToWaveStream(stream);
ss.Speak(toSay);
byte[] bytes = stream.GetBuffer();
vc.SendVoice(bytes);
Console.WriteLine("Said : " + toSay);
}
vc.SetSpeaking(false);
}
catch (Exception ex)
{
try
{
//MainEntry.owner.SendMessage("Exception during voice: " + ex.Message + "
\n\n" + ex.StackTrace + "\n
");
}
catch { }
}
}
Couple of questions. How can I make it respond to what was said in a voice chat room. Or do an event when someone joins and room and use the microphone in discord?
Or just not possible?