This commit is contained in:
Will Nelson
2017-04-21 16:56:23 -07:00
committed by Crawl
parent 5605dc04e1
commit 794c0e131d
3 changed files with 23 additions and 12 deletions

View File

@@ -27,8 +27,9 @@ class MessageCollector extends Collector {
this.channel = channel; this.channel = channel;
/** /**
* @type {number} received Total number of messages that were received in the * Total number of messages that were received in the
* channel during message collection. * channel during message collection.
* @type {number}
*/ */
this.received = 0; this.received = 0;

View File

@@ -23,17 +23,20 @@ class ReactionCollector extends Collector {
super(message.client, filter, options); super(message.client, filter, options);
/** /**
* @type {Message} message The message. * The message.
* @type {Message}
*/ */
this.message = message; this.message = message;
/** /**
* @type {Collection} users Users which have reacted. * Users which have reacted.
* @type {Collection}
*/ */
this.users = new Collection(); this.users = new Collection();
/** /**
* @type {number} total Total number of reactions collected. * Total number of reactions collected.
* @type {number}
*/ */
this.total = 0; this.total = 0;

View File

@@ -23,39 +23,46 @@ class Collector extends EventEmitter {
super(); super();
/** /**
* @type {Client} client The client. * The client.
* @type {Client}
*/ */
this.client = client; this.client = client;
/** /**
* @type {CollectorFilter} filter The filter applied to this collector. * The filter applied to this collector.
* @type {CollectorFilter}
*/ */
this.filter = filter; this.filter = filter;
/** /**
* @type {CollectorOptions} options The options of this collector. * The options of this collector.
* @type {CollectorOptions}
*/ */
this.options = options; this.options = options;
/** /**
* @type {Collection} collected The items collected by this collector. * The items collected by this collector.
* @type {Collection}
*/ */
this.collected = new Collection(); this.collected = new Collection();
/** /**
* @type {boolean} ended Whether this collector has finished collecting. * Whether this collector has finished collecting.
* @type {boolean}
*/ */
this.ended = false; this.ended = false;
/** /**
* @type {?number} _timeout Timeout ID for cleanup. * Timeout ID for cleanup.
* @type {?number}
* @private * @private
*/ */
this._timeout = null; this._timeout = null;
/** /**
* @type {Function} listener Call this to handle an event as a collectable element. * Call this to handle an event as a collectable element.
* Accepts any event data as parameters. * Accepts any event data as parameters.
* @type {Function}
* @private * @private
*/ */
this.listener = this._handle.bind(this); this.listener = this._handle.bind(this);
@@ -77,7 +84,7 @@ class Collector extends EventEmitter {
* Emitted whenever an element is collected. * Emitted whenever an element is collected.
* @event Collector#collect * @event Collector#collect
* @param {*} element The element that got collected. * @param {*} element The element that got collected.
* @param {Collector} collector The message collector. * @param {Collector} collector The collector.
*/ */
this.emit('collect', collect.value, this); this.emit('collect', collect.value, this);