MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added. Use emitter.setMaxListeners() to increase limit
Why is say this in logs ?
what are those ? :)))
It appears your hooking into the same event in an EventEmitter. Please send your project link or a code snippet so we can understand further.
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added. Use emitter.setMaxListeners() to increase limit
Why is say this in logs ?
Something like this:
client.on(`message`, async function (msg){
});
I think you did this for every single command when instead you should probably put all of your commands in one like this.
client.on(`message`, async function (msg){
if(msg.content.startsWith(`!hello`)){
msg.reply(`Hi!`);
}
if(msg.content.startsWith(`!cya`)){
msg.reply(`Bye!`);
}
});
1 Like
what if you use else
for example
client.on(`message`, async function (msg){
if(msg.content.startsWith(`!hello`)){
msg.reply(`Hi!`);
}else
if(msg.content.startsWith(`!cya`)){
msg.reply(`Bye!`);
}