mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
Pass the collection of X collected in collectors (#1594)
...to the filter function.
This commit is contained in:
@@ -5,6 +5,7 @@ const EventEmitter = require('events');
|
||||
* Filter to be applied to the collector.
|
||||
* @typedef {Function} CollectorFilter
|
||||
* @param {...*} args Any arguments received by the listener
|
||||
* @param {Collection} collection The items collected by this collector
|
||||
* @returns {boolean} To collect or not collect
|
||||
*/
|
||||
|
||||
@@ -75,7 +76,7 @@ class Collector extends EventEmitter {
|
||||
*/
|
||||
handleCollect(...args) {
|
||||
const collect = this.collect(...args);
|
||||
if (!collect || !this.filter(...args)) return;
|
||||
if (!collect || !this.filter(...args, this.collected)) return;
|
||||
|
||||
this.collected.set(collect.key, collect.value);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user