Rei-x / discord-speech-recognition

Speech to text extension for discord.js
https://npmjs.com/package/discord-speech-recognition
MIT License
56 stars 22 forks source link

Change SpeechOptions after adding the speech event. #61

Closed mbarretol closed 8 months ago

mbarretol commented 1 year ago

Hi @Rei-x,

Hope you're well. I'm creating this issue to kindly request an update on the feature to change the speechOptions after addSpeechEvent (from issue #57). Any timeline or progress made would be appreciated.

Thanks for your great work on this project!

Rei-x commented 1 year ago

Hi @Narco121, try the latest version, now it should be possible!

mbarretol commented 1 year ago

Hi @Rei-x, I've noticed an issue with shouldProcessSpeech. The shouldProcessSpeech speechOption can't be changed if it wasn't initially set in addSpeechEvent.

Example: const speechOptions = addSpeechEvent(interaction.client, { lang: LANGUAGE, profanityFilter: PROFANITYFILTER, });

connection.on('example', (userId) => { speechOptions.shouldProcessSpeech('userId'); });

TypeError: speechOptions.shouldProcessSpeech is not a function Could this be looked into for a future update? Thanks for your great work on this project.

Rei-x commented 1 year ago

@Narco121, if you want to change shouldProcessSpeech you should do something like this:

const speechOptions = addSpeechEvent(client);

speechOptions.shouldProcessSpeech = (userId) => {
  return userId === "myId"
}

By default shouldProcessSpeech is undefined so you can't call it directly without getting an error.

If it isn't what you want, please tell me more about your use case, so I can help you better.