Webpack build for branch master: e576387fea

This commit is contained in:
Travis CI 2018-01-16 00:37:31 +00:00
parent b0bc35a612
commit c1c5aaa1de
2 changed files with 42 additions and 26 deletions

View file

@ -8179,15 +8179,14 @@ class Collector extends EventEmitter {
const collect = this.collect(...args); const collect = this.collect(...args);
if (collect && this.filter(...args, this.collected)) { if (collect && this.filter(...args, this.collected)) {
this.collected.set(collect.key, collect.value); this.collected.set(collect, args[0]);
/** /**
* 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 {...*} args The arguments emitted by the listener * @param {...*} args The arguments emitted by the listener
*/ */
this.emit('collect', collect.value, ...args); this.emit('collect', ...args);
} }
this.checkEnd(); this.checkEnd();
} }
@ -8202,17 +8201,14 @@ class Collector extends EventEmitter {
const dispose = this.dispose(...args); const dispose = this.dispose(...args);
if (!dispose || !this.filter(...args) || !this.collected.has(dispose)) return; if (!dispose || !this.filter(...args) || !this.collected.has(dispose)) return;
const value = this.collected.get(dispose);
this.collected.delete(dispose); this.collected.delete(dispose);
/** /**
* Emitted whenever an element has been disposed. * Emitted whenever an element is disposed of.
* @event Collector#dispose * @event Collector#dispose
* @param {*} element The element that was disposed
* @param {...*} args The arguments emitted by the listener * @param {...*} args The arguments emitted by the listener
*/ */
this.emit('dispose', value, ...args); this.emit('dispose', ...args);
this.checkEnd(); this.checkEnd();
} }
@ -9560,24 +9556,31 @@ class MessageCollector extends Collector {
/** /**
* Handles a message for possible collection. * Handles a message for possible collection.
* @param {Message} message The message that could be collected * @param {Message} message The message that could be collected
* @returns {?{key: Snowflake, value: Message}} * @returns {?Snowflake}
* @private * @private
*/ */
collect(message) { collect(message) {
/**
* Emitted whenever a message is collected.
* @event MessageCollector#collect
* @param {Message} message The message that was collected
*/
if (message.channel.id !== this.channel.id) return null; if (message.channel.id !== this.channel.id) return null;
this.received++; this.received++;
return { return message.id;
key: message.id,
value: message,
};
} }
/** /**
* Handles a message for possible disposal. * Handles a message for possible disposal.
* @param {Message} message The message that could be disposed * @param {Message} message The message that could be disposed of
* @returns {?string} * @returns {?Snowflake}
*/ */
dispose(message) { dispose(message) {
/**
* Emitted whenever a message is disposed of.
* @event MessageCollector#dispose
* @param {Message} message The message that was disposed of
*/
return message.channel.id === this.channel.id ? message.id : null; return message.channel.id === this.channel.id ? message.id : null;
} }
@ -10946,12 +10949,12 @@ class ReactionCollector extends Collector {
this.client.removeListener(Events.MESSAGE_REACTION_REMOVE_ALL, this.empty); this.client.removeListener(Events.MESSAGE_REACTION_REMOVE_ALL, this.empty);
}); });
this.on('collect', (collected, reaction, user) => { this.on('collect', (reaction, user) => {
this.total++; this.total++;
this.users.set(user.id, user); this.users.set(user.id, user);
}); });
this.on('dispose', (disposed, reaction, user) => { this.on('remove', (reaction, user) => {
this.total--; this.total--;
if (!this.collected.some(r => r.users.has(user.id))) this.users.delete(user.id); if (!this.collected.some(r => r.users.has(user.id))) this.users.delete(user.id);
}); });
@ -10960,23 +10963,33 @@ class ReactionCollector extends Collector {
/** /**
* Handles an incoming reaction for possible collection. * Handles an incoming reaction for possible collection.
* @param {MessageReaction} reaction The reaction to possibly collect * @param {MessageReaction} reaction The reaction to possibly collect
* @returns {?{key: Snowflake, value: MessageReaction}} * @returns {?Snowflake|string}
* @private * @private
*/ */
collect(reaction) { collect(reaction) {
/**
* Emitted whenever a reaction is collected.
* @event ReactionCollector#collect
* @param {MessageReaction} reaction The reaction that was collected
* @param {User} user The user that added the reaction
*/
if (reaction.message.id !== this.message.id) return null; if (reaction.message.id !== this.message.id) return null;
return { return ReactionCollector.key(reaction);
key: ReactionCollector.key(reaction),
value: reaction,
};
} }
/** /**
* Handles a reaction deletion for possible disposal. * Handles a reaction deletion for possible disposal.
* @param {MessageReaction} reaction The reaction to possibly dispose * @param {MessageReaction} reaction The reaction to possibly dispose of
* @param {User} user The user that removed the reaction
* @returns {?Snowflake|string} * @returns {?Snowflake|string}
*/ */
dispose(reaction) { dispose(reaction, user) {
/**
* Emitted whenever a reaction is disposed of.
* @event ReactionCollector#dispose
* @param {MessageReaction} reaction The reaction that was disposed of
* @param {User} user The user that removed the reaction
*/
if (reaction.message.id !== this.message.id) return null; if (reaction.message.id !== this.message.id) return null;
/** /**
@ -10985,8 +10998,11 @@ class ReactionCollector extends Collector {
* is removed. * is removed.
* @event ReactionCollector#remove * @event ReactionCollector#remove
* @param {MessageReaction} reaction The reaction that was removed * @param {MessageReaction} reaction The reaction that was removed
* @param {User} user The user that removed the reaction
*/ */
if (this.collected.has(reaction)) this.emit('remove', reaction); if (this.collected.has(ReactionCollector.key(reaction))) {
this.emit('remove', reaction, user);
}
return reaction.count ? null : ReactionCollector.key(reaction); return reaction.count ? null : ReactionCollector.key(reaction);
} }

File diff suppressed because one or more lines are too long