From bce5b677adea4d64e7d6097e399c0b6042399957 Mon Sep 17 00:00:00 2001 From: iCrawl Date: Thu, 24 Aug 2017 00:35:44 +0200 Subject: [PATCH] Backport passing a collection to a collector --- src/structures/interfaces/Collector.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/structures/interfaces/Collector.js b/src/structures/interfaces/Collector.js index 287256ebe..10a46b18e 100644 --- a/src/structures/interfaces/Collector.js +++ b/src/structures/interfaces/Collector.js @@ -5,7 +5,8 @@ const EventEmitter = require('events').EventEmitter; * Filter to be applied to the collector. * @typedef {Function} CollectorFilter * @param {...*} args Any arguments received by the listener - * @returns {boolean} To collect or not collect + * @param {Collection} collection The items collected by this collector + * @returns {boolean} */ /** @@ -78,7 +79,7 @@ class Collector extends EventEmitter { */ _handle(...args) { const collect = this.handle(...args); - if (!collect || !this.filter(...args)) return; + if (!collect || !this.filter(...args, this.collected)) return; this.collected.set(collect.key, collect.value);