mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 03:53:29 +01:00
Backport passing a collection to a collector
This commit is contained in:
@@ -5,7 +5,8 @@ const EventEmitter = require('events').EventEmitter;
|
|||||||
* 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
|
||||||
* @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) {
|
_handle(...args) {
|
||||||
const collect = this.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);
|
this.collected.set(collect.key, collect.value);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user