mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +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.
|
* Filter to be applied to the collector.
|
||||||
* @typedef {Function} CollectorFilter
|
* @typedef {Function} CollectorFilter
|
||||||
* @param {...*} args Any arguments received by the listener
|
* @param {...*} args Any arguments received by the listener
|
||||||
|
* @param {Collection} collection The items collected by this collector
|
||||||
* @returns {boolean} To collect or not collect
|
* @returns {boolean} To collect or not collect
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -75,7 +76,7 @@ class Collector extends EventEmitter {
|
|||||||
*/
|
*/
|
||||||
handleCollect(...args) {
|
handleCollect(...args) {
|
||||||
const collect = this.collect(...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);
|
this.collected.set(collect.key, collect.value);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user