mirror of
https://github.com/danbulant/discord.js
synced 2026-06-09 17:52:55 +00:00
emit ReactionCollector#remove on all unreactions (#2096)
* emit ReactionCollector#remove on all unreactions this will emit an event when a user removes a collected reaction. this is in addition to Collector#dispose, which will only fire when all users have unreacted to the same emoji. * emit only collected removals
This commit is contained in:
parent
2d8e26c24c
commit
09315ae9db
1 changed files with 11 additions and 1 deletions
|
|
@ -83,7 +83,17 @@ class ReactionCollector extends Collector {
|
||||||
* @returns {?Snowflake|string}
|
* @returns {?Snowflake|string}
|
||||||
*/
|
*/
|
||||||
dispose(reaction) {
|
dispose(reaction) {
|
||||||
return reaction.message.id === this.message.id && !reaction.count ? ReactionCollector.key(reaction) : null;
|
if (reaction.message.id !== this.message.id) return null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Emitted whenever a reaction is removed from a message. Will emit on all reaction removals,
|
||||||
|
* as opposed to {@link Collector#dispose} which will only be emitted when the entire reaction
|
||||||
|
* is removed.
|
||||||
|
* @event ReactionCollector#remove
|
||||||
|
* @param {MessageReaction} reaction The reaction that was removed
|
||||||
|
*/
|
||||||
|
if (this.collected.has(reaction)) this.emit('remove', reaction);
|
||||||
|
return reaction.count ? null : ReactionCollector.key(reaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue