(node:19176) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 data listeners added to [AudioReceiveStream]. Use emitter.setMaxListeners() to increase limit
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 data listeners added to [AudioReceiveStream]. Use emitter.setMaxListeners() to increase limit
at __node_internal_genericNodeError (node:internal/errors:863:15)
at _addListener (node:events:587:17)
at AudioReceiveStream.addListener (node:events:605:10)
at Readable.on (node:internal/streams/readable:887:35)
at Readable.pipe (node:internal/streams/readable:763:7)
at _SpeakingMap.handleSpeechEventOnConnectionReceiver (D:\projects\MusicBot\node_modules\discord-speech-recognition\src\bot\events\speech.ts:74:10)
at _SpeakingMap.emit (node:events:513:28)
at onPacket (D:\projects\MusicBot\node_modules\@discordjs\voice\src\receive\SpeakingMap.ts:48:9)
at onUdpMessage (D:\projects\MusicBot\node_modules\@discordjs\voice\src\receive\VoiceReceiver.ts:142:17) at VoiceUDPSocket.emit (node:events:513:28)
const voiceHandler = (voice) => {
if (!voice.content) {
return; //if no speech detected, do nothing
}
//console.log(`${voice.author.username} said ${voice.content}`);
if (voice.content.toLowerCase().includes('music')){
//console.log(voice);
voice.content = `!${voice.content.toLowerCase().split('music')[1].trim()}`; //append '!' so everything else works
console.log(`${voice.author.username} said '${voice.content}'`)
command(voice);
}
//client.removeListener('speech', voiceHandler);
}
client.on(SpeechEvents.speech, voiceHandler);
Not sure what I can do to stop the warning, seems like it originates from the module itself. Any suggestions appreciated.
Not sure what I can do to stop the warning, seems like it originates from the module itself. Any suggestions appreciated.