class ReactionCollector

export class ReactionCollector extends Collector<Snowflake | string, MessageReaction, [User]>

Collects reactions on messages. Will automatically stop if the message (messageDelete or messageDeleteBulk), channel (channelDelete), thread (threadDelete), or guild (guildDelete) is deleted.

Constructors

constructor()

readonly
client : Client

The client that instantiated this Collector

collected : Collection

The items collected by this collector

ended : boolean

Whether this collector has finished collecting

readonlyoptional
endReason? : string

The reason this collector has ended with, or null if it hasn't ended yet

The filter applied to this collector

optional
lastCollectedAt? : Date

The Date at which this collector last collected an item

optional
lastCollectedTimestamp? : number

The timestamp at which this collector last collected an item

protected
listener : (...args: any[]) => void

Inherited from: Collector

message : Message

The message upon which to collect reactions

readonly
next : Promise

Returns a promise that resolves with the next collected element; rejects with collected elements if the collector finishes without receiving a next element

The options of this collector

total : number

The total number of reactions collected

The users that have reacted to this message

[Symbol.asyncIterator]() : AsyncIterableIterator<[MessageReaction, ...[]>

Inherited from: Collector

checkEnd() : boolean

Checks whether the collector should end, and if so, ends it.

Returns: Whether the collector ended or not

Inherited from: Collector

collect(
reaction: MessageReaction
user: User
) : Snowflake | string | null

Handles an incoming reaction for possible collection.

dispose(
reaction: MessageReaction
user: User
) : Snowflake | string | null

Handles a reaction deletion for possible disposal.

empty() : void

Empties this reaction collector.

handleCollect(
...args: unknown[]
) : Promise<void>

Call this to handle an event as a collectable element. Accepts any event data as parameters.

Inherited from: Collector

handleDispose(
...args: unknown[]
) : Promise<void>

Call this to remove an element from the collection. Accepts any event data as parameters.

Inherited from: Collector

static
key(
reaction: MessageReaction
) : Snowflake | string

Gets the collector key for a reaction.

on(
event: 'collect' | 'dispose' | 'remove' | 'ignore'
listener: (reaction: MessageReaction, user: User) => void
) : this

once(
event: 'collect' | 'dispose' | 'remove' | 'ignore'
listener: (reaction: MessageReaction, user: User) => void
) : this

resetTimer() : void

Resets the collector's timeout and idle timer.

Inherited from: Collector

stop(
reason?: string
) : void

Stops this collector and emits the end event.

Inherited from: Collector

toJSON() : unknown

Inherited from: Collector

collect(
reaction: MessageReaction
user: User
)

Emitted whenever a reaction is collected.

create(
reaction: MessageReaction
user: User
)

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 which will be emitted even when a reaction has already been added to the message.

dispose(
reaction: MessageReaction
user: User
)

Emitted when the reaction had all the users removed and the dispose option is set to true.

end(
collected: Collection
reason: string
)

Emitted when the collector is finished collecting.

ignore(
args: any
)

Emitted whenever an element is not collected by the collector.

remove(
reaction: MessageReaction
user: User
)

Emitted when the reaction had one user removed and the dispose option is set to true.