mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
fix(*Collector): account for a max listener count of 0 (#3504)
This commit is contained in:
@@ -44,7 +44,7 @@ class ReactionCollector extends Collector {
|
||||
|
||||
this.empty = this.empty.bind(this);
|
||||
|
||||
this.client.setMaxListeners(this.client.getMaxListeners() + 1);
|
||||
if (this.client.getMaxListeners() !== 0) this.client.setMaxListeners(this.client.getMaxListeners() + 1);
|
||||
this.client.on(Events.MESSAGE_REACTION_ADD, this.handleCollect);
|
||||
this.client.on(Events.MESSAGE_REACTION_REMOVE, this.handleDispose);
|
||||
this.client.on(Events.MESSAGE_REACTION_REMOVE_ALL, this.empty);
|
||||
@@ -53,7 +53,7 @@ class ReactionCollector extends Collector {
|
||||
this.client.removeListener(Events.MESSAGE_REACTION_ADD, this.handleCollect);
|
||||
this.client.removeListener(Events.MESSAGE_REACTION_REMOVE, this.handleDispose);
|
||||
this.client.removeListener(Events.MESSAGE_REACTION_REMOVE_ALL, this.empty);
|
||||
this.client.setMaxListeners(this.client.getMaxListeners() - 1);
|
||||
if (this.client.getMaxListeners() !== 0) this.client.setMaxListeners(this.client.getMaxListeners() - 1);
|
||||
});
|
||||
|
||||
this.on('collect', (reaction, user) => {
|
||||
|
||||
Reference in New Issue
Block a user