Closed lmmfranco closed 2 years ago
I'm sorry, but I can't reproduce it. When I run your code, I get correct output: Do you use the latest version of the package?
And also, you don't have to specify language for wit.ai in speechOptions (cuz it doesn't have any effect), you do it in your app settings:
It seems to be related to how many people are connected to the channel. I had another (silent) bot join. Every time it would join the SR bot add another copy of every sound spoken:
BOT READY
[M] darkbreaker ##join
[S] darkbreaker: This is that one.
[M] darkbreaker ..join
[S] darkbreaker: This is test two.
[S] darkbreaker: This is test too.
[M] darkbreaker ..leave
[M] darkbreaker ..join
[S] darkbreaker: This is test three.
[S] darkbreaker: This is test three.
[S] darkbreaker: This is test three.
I will try and debug the code when I have more time in order to provide better feedback
I guess this is the relevant bit: https://github.com/Rei-x/discord-speech-recognition/blob/27d28486c9f5253189636d45fce51c9323b49810/src/bot/events/speech.ts#L61-L66
There is a receiver being created every time anyone joins the channel. There's only need for one receiver to be in place, as it will fire serveral times as long as it is subscribed to.
There could be a check to run the code when the bot itself joins.
In @discordjs/voice example they setup the receiver on the /join command of their bot: https://github.com/discordjs/voice/blob/main/examples/recorder/src/interactions.ts
Yes, it's exactly what causes the issue, I'll fix it as soon as possible. Thank you a lot for help!
Fixed in #18 Install new version of package (2.1.0) and check if it now works.
DiscordSR seems to be sending multiple requests when using wit.ai.
Code used for this test:
Resulting log:
Both even show up on wit.ai dashboard:
When using just
addSpeechEvent(client);
with the default google SR it worked as intended: