mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
fix(*Collector): account for a max listener count of 0 (#3504)
This commit is contained in:
@@ -39,7 +39,7 @@ class MessageCollector extends Collector {
|
||||
for (const message of messages.values()) this.handleDispose(message);
|
||||
}).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_DELETE, this.handleDispose);
|
||||
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_DELETE, this.handleDispose);
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user