mirror of
https://github.com/danbulant/discord.js
synced 2026-05-27 14:02:02 +00:00
fix(*Collector): account for a max listener count of 0 (#3504)
This commit is contained in:
parent
3c634b2a26
commit
2e20e8092b
2 changed files with 4 additions and 4 deletions
|
|
@ -39,7 +39,7 @@ class MessageCollector extends Collector {
|
||||||
for (const message of messages.values()) this.handleDispose(message);
|
for (const message of messages.values()) this.handleDispose(message);
|
||||||
}).bind(this);
|
}).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_CREATE, this.handleCollect);
|
this.client.on(Events.MESSAGE_CREATE, this.handleCollect);
|
||||||
this.client.on(Events.MESSAGE_DELETE, this.handleDispose);
|
this.client.on(Events.MESSAGE_DELETE, this.handleDispose);
|
||||||
this.client.on(Events.MESSAGE_BULK_DELETE, bulkDeleteListener);
|
this.client.on(Events.MESSAGE_BULK_DELETE, bulkDeleteListener);
|
||||||
|
|
@ -48,7 +48,7 @@ class MessageCollector extends Collector {
|
||||||
this.client.removeListener(Events.MESSAGE_CREATE, this.handleCollect);
|
this.client.removeListener(Events.MESSAGE_CREATE, this.handleCollect);
|
||||||
this.client.removeListener(Events.MESSAGE_DELETE, this.handleDispose);
|
this.client.removeListener(Events.MESSAGE_DELETE, this.handleDispose);
|
||||||
this.client.removeListener(Events.MESSAGE_BULK_DELETE, bulkDeleteListener);
|
this.client.removeListener(Events.MESSAGE_BULK_DELETE, bulkDeleteListener);
|
||||||
this.client.setMaxListeners(this.client.getMaxListeners() - 1);
|
if (this.client.getMaxListeners() !== 0) this.client.setMaxListeners(this.client.getMaxListeners() - 1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ class ReactionCollector extends Collector {
|
||||||
|
|
||||||
this.empty = this.empty.bind(this);
|
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_ADD, this.handleCollect);
|
||||||
this.client.on(Events.MESSAGE_REACTION_REMOVE, this.handleDispose);
|
this.client.on(Events.MESSAGE_REACTION_REMOVE, this.handleDispose);
|
||||||
this.client.on(Events.MESSAGE_REACTION_REMOVE_ALL, this.empty);
|
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_ADD, this.handleCollect);
|
||||||
this.client.removeListener(Events.MESSAGE_REACTION_REMOVE, this.handleDispose);
|
this.client.removeListener(Events.MESSAGE_REACTION_REMOVE, this.handleDispose);
|
||||||
this.client.removeListener(Events.MESSAGE_REACTION_REMOVE_ALL, this.empty);
|
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) => {
|
this.on('collect', (reaction, user) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue