Constructor
new MessageCollector(channel, filter, options)
Parameters:
Name | Type | Description |
---|---|---|
channel |
TextChannel | DMChannel | The channel |
filter |
CollectorFilter | The filter to be applied to this collector |
options |
MessageCollectorOptions | The options to be applied to this collector |
Fires:
- MessageCollector#event:message
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:
channel :TextBasedChannel
The channel
Type:
(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:
(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:
received :number
Total number of messages that were received in the channel during message collection
Type:
- number
Methods
(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
checkEnd()
Checks whether the collector should end, and if so, ends it.
- Overrides:
- Source:
(private) collect(message) → {Snowflake}
Handles a message for possible collection.
Parameters:
Name | Type | Description |
---|---|---|
message |
Message | The message that could be collected |
- Overrides:
- Source:
Returns:
- Type
- Snowflake
dispose(message) → {Snowflake}
Handles a message for possible disposal.
Parameters:
Name | Type | Description |
---|---|---|
message |
Message | The message that could be disposed of |
- Overrides:
- Source:
Returns:
- Type
- Snowflake
(private) endReason() → {string}
Checks after un/collection to see if the collector is done.
- Overrides:
- Source:
Returns:
- 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 message is collected.
Parameters:
Name | Type | Description |
---|---|---|
message |
Message | The message that was collected |
- Overrides:
- Source:
dispose
Emitted whenever a message is disposed of.
Parameters:
Name | Type | Description |
---|---|---|
message |
Message | The message that was disposed of |
- 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: