Constructor
new ReactionCollector(message, filter, optionsopt)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
message |
Message | The message upon which to collect reactions | ||
filter |
CollectorFilter | The filter to apply to this collector | ||
options |
ReactionCollectorOptions |
<optional> |
{} | The options to apply to this collector |
Extends
Members
(private, nullable) _idletimeout :Timeout
Timeout for cleanup due to inactivity
Type:
- Timeout
- Overrides:
- Source:
(private, nullable) _timeout :Timeout
Timeout for cleanup
Type:
- Timeout
- Overrides:
- Source:
(readonly) client :Client
The client that instantiated this Collector
Type:
- Overrides:
- Source:
collected :Collection
The items collected by this collector
Type:
- Collection
- Overrides:
- Source:
ended :boolean
Whether this collector has finished collecting
Type:
- boolean
- Overrides:
- Source:
filter :CollectorFilter
The filter applied to this collector
Type:
- Overrides:
- Source:
message :Message
The message upon which to collect reactions
Type:
(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
Type:
- Promise
- Overrides:
- Source:
options :CollectorOptions
The options of this collector
Type:
- Overrides:
- Source:
total :number
The total number of reactions collected
Type:
- number
users :Collection
The users which have reacted to this message
Type:
- Collection
Methods
(static) key(reaction) → {Snowflake|string}
Gets the collector key for a reaction.
Parameters:
Name | Type | Description |
---|---|---|
reaction |
MessageReaction | The message reaction to get the key for |
Returns:
- Type
- Snowflake | string
(private) _handleChannelDeletion(channel) → {void}
Handles checking if the channel has been deleted, and if so, stops the collector with the reason 'channelDelete'.
Parameters:
Name | Type | Description |
---|---|---|
channel |
GuildChannel | The channel that was deleted |
Returns:
- Type
- void
(private) _handleGuildDeletion(guild) → {void}
Handles checking if the guild has been deleted, and if so, stops the collector with the reason 'guildDelete'.
Parameters:
Name | Type | Description |
---|---|---|
guild |
Guild | The guild that was deleted |
Returns:
- Type
- void
(private) _handleMessageDeletion(message) → {void}
Handles checking if the message has been deleted, and if so, stops the collector with the reason 'messageDelete'.
Parameters:
Name | Type | Description |
---|---|---|
message |
Message | The message that was deleted |
Returns:
- Type
- void
checkEnd()
Checks whether the collector should end, and if so, ends it.
- Overrides:
- Source:
(private) collect(reaction) → {Snowflake|string}
Handles an incoming reaction for possible collection.
Parameters:
Name | Type | Description |
---|---|---|
reaction |
MessageReaction | The reaction to possibly collect |
- Overrides:
- Source:
Returns:
- Type
- Snowflake | string
dispose(reaction, user) → {Snowflake|string}
Handles a reaction deletion for possible disposal.
Parameters:
Name | Type | Description |
---|---|---|
reaction |
MessageReaction | The reaction to possibly dispose of |
user |
User | The user that removed the reaction |
- Overrides:
- Source:
Returns:
- Type
- Snowflake | string
empty()
Empties this reaction collector.
(abstract) endReason() → {string}
The reason this collector has ended or will end with.
- Overrides:
- Source:
Returns:
Reason to end the collector, if any
- Type
- string
(async) handleCollect(…args)
Call this to handle an event as a collectable element. Accepts any event data as parameters.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
* |
<repeatable> |
The arguments emitted by the listener |
- Overrides:
- Source:
Fires:
handleDispose(…args)
Call this to remove an element from the collection. Accepts any event data as parameters.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
* |
<repeatable> |
The arguments emitted by the listener |
- Overrides:
- Source:
Fires:
resetTimer(optionsopt)
Resets the collectors timeout and idle timer.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
Options
Properties
|
- Overrides:
- Source:
stop(reasonopt)
Stops this collector and emits the `end` event.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
reason |
string |
<optional> |
'user' | The reason this collector is ending |
- Overrides:
- Source:
Fires:
Events
collect
Emitted whenever a reaction is collected.
Parameters:
Name | Type | Description |
---|---|---|
reaction |
MessageReaction | The reaction that was collected |
user |
User | The user that added the reaction |
- Overrides:
- Source:
dispose
Emitted whenever a reaction is disposed of and the `dispose` option is set to true.
Parameters:
Name | Type | Description |
---|---|---|
reaction |
MessageReaction | The reaction that was disposed of |
user |
User | The user that removed the reaction |
- Overrides:
- Source:
end
Emitted when the collector is finished collecting.
Parameters:
Name | Type | Description |
---|---|---|
collected |
Collection | The elements collected by the collector |
reason |
string | The reason the collector ended |
- Overrides:
- Source:
remove
Emitted whenever a reaction is removed from a message and the `dispose` option is set to true.
Will emit on all reaction removals, as opposed to Collector#dispose which will only
be emitted when the entire reaction is removed.
Parameters:
Name | Type | Description |
---|---|---|
reaction |
MessageReaction | The reaction that was removed |
user |
User | The user that removed the reaction |