From 9c2e3b8978ac0e82309c11eb838cf702473bc0df Mon Sep 17 00:00:00 2001 From: bdistin Date: Sun, 20 Aug 2017 16:13:08 -0500 Subject: [PATCH] Pass the collection of X collected in collectors (#1594) ...to the filter function. --- src/structures/interfaces/Collector.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/structures/interfaces/Collector.js b/src/structures/interfaces/Collector.js index 017c3797d..73bbcde59 100644 --- a/src/structures/interfaces/Collector.js +++ b/src/structures/interfaces/Collector.js @@ -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);