Every time I try to make more than 10 commands I get the error:
node MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit
I tried fixing it by doing emitter.setMaxListeners()
and it didn’t fix it so I searched online and tried to fix it by using process.setMaxListeners(0);
but that didn’t work either. If there is a fix for this please let me know, and if you want to see what code I have written for my bot please let me know which part of the code you would like to see.
Advertisement
Answer
const client = new Discord.Client(); client.setMaxListeners(0);
it’s not emitter or process you are doing it to, it’s the client. Oh and I am pretty sure you need it at the top of your code, before your commands