Rei-x/discord-speech-recognition

Suggestion: Filter out sounds from other bots

lmmfranco opened this issue · 2 comments

Having a music/sound bot in the same channel can spam the speech recognition with useless requests. Would be nice to have a setting (or even by default) to ignore messages from bots.

Rei-x commented

You can make a pull request for this feature. Basically add checking if user is a bot in handleSpeechEvent (of course it's only my suggestion, you can figure out something by yourself)

function handleSpeechEventOnConnectionReceiver(userId) {

How to check if user is a bot?

client.users.cache.get(userId).bot // returns true when user is a bot

To add another options to bot modify this interface:

/**
* Options that will be passed to [[speechRecognition]] function
*/
export interface SpeechOptions {
group?: string;
lang?: string;
speechRecognition?: SpeechRecognition;
key?: string;
}

Here you can specify default options:

export const addSpeechEvent = (client: Client, options?: SpeechOptions) => {
const defaultOptions = {
lang: "en-US",
speechRecognition: resolveSpeechWithGoogleSpeechV2,
};

I will be more than happy to review your PR and also by contributing to this repository you will get a chance to win a t-shirt in hacktoberfest event - read more here https://hacktoberfest.digitalocean.com/

Rei-x commented

Added in #25