mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 17:13:31 +01:00
feat(ReactionCollector): event create (#4108)
* fix(Typing): setSpeaking public
* feat(ReactionCollector): create event, close #2844
* Revert "fix(Typing): setSpeaking public"
This reverts commit ccc0e0cc76.
This commit is contained in:
@@ -81,10 +81,11 @@ class ReactionCollector extends Collector {
|
||||
/**
|
||||
* Handles an incoming reaction for possible collection.
|
||||
* @param {MessageReaction} reaction The reaction to possibly collect
|
||||
* @param {User} user The user that added the reaction
|
||||
* @returns {?Snowflake|string}
|
||||
* @private
|
||||
*/
|
||||
collect(reaction) {
|
||||
collect(reaction, user) {
|
||||
/**
|
||||
* Emitted whenever a reaction is collected.
|
||||
* @event ReactionCollector#collect
|
||||
@@ -92,6 +93,19 @@ class ReactionCollector extends Collector {
|
||||
* @param {User} user The user that added the reaction
|
||||
*/
|
||||
if (reaction.message.id !== this.message.id) return null;
|
||||
|
||||
/**
|
||||
* Emitted whenever a reaction is newly created on a message. Will emit only when a new reaction is
|
||||
* added to the message, as opposed to {@link Collector#collect} which which will
|
||||
* be emitted even when a reaction has already been added to the message.
|
||||
* @event ReactionCollector#create
|
||||
* @param {MessageReaction} reaction The reaction that was added
|
||||
* @param {User} user The user that added the reaction
|
||||
*/
|
||||
if (reaction.count === 1 && this.filter(reaction, user, this.collected)) {
|
||||
this.emit('create', reaction, user);
|
||||
}
|
||||
|
||||
return ReactionCollector.key(reaction);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user