MessageCollector

export class MessageCollector extends Collector<Snowflake, Message, [Collection<Snowflake, Message>]>
export class MessageCollector extends Collector<Snowflake, Message, [Collection<Snowflake, Message>]>
Collects messages on a channel. Will automatically stop if the channel (), thread (), or guild () is deleted.
constructor(channel, options?)
NameTypeOptionalDescription
channelTextBasedChannelNoNone
optionsMessageCollectorOptionsYesNone
collect(message)
Emitted whenever a message is collected.
NameTypeOptionalDescription
messageMessageNoThe message that was collected
dispose(message)
Emitted whenever a message is disposed of.
NameTypeOptionalDescription
messageMessageNoThe message that was disposed of
end(collected, reason)
Emitted when the collector is finished collecting.
NameTypeOptionalDescription
collectedCollectionNoThe elements collected by the collector
reasonstringNoThe reason the collector ended
ignore(args)
Emitted whenever an element is not collected by the collector.
NameTypeOptionalDescription
args*NoThe arguments emitted by the listener
The channel
Readonly
client:Client
The client that instantiated this Collector
Inherited from Collector
collected:Collection<K, V>
The items collected by this collector
Inherited from Collector
ended:boolean
Whether this collector has finished collecting
Inherited from Collector
Readonly
endReason:string | null
The reason this collector has ended with, or null if it hasn't ended yet
Inherited from Collector
filter:CollectorFilter<[V, ...F]>
The filter applied to this collector
Inherited from Collector
Readonly
lastCollectedAt:Date | null
The Date at which this collector last collected an item
Inherited from Collector
lastCollectedTimestamp:number | null
The timestamp at which this collector last collected an item
Inherited from Collector
Protected
listener:(...args: any[]) => void
Inherited from Collector
The options of this collector
received:number
Total number of messages that were received in the channel during message collection
[Symbol.asyncIterator]():AsyncIterableIterator<[V, ...F]>
checkEnd():boolean
Checks whether the collector should end, and if so, ends it.
Returns
Whether the collector ended or not
Inherited from Collector
collect(message):Snowflake | null
Handles a message for possible collection.
Returns
NameTypeOptionalDescription
messageMessageNoThe message that could be collected
dispose(message):Snowflake | null
Handles a message for possible disposal.
Returns
NameTypeOptionalDescription
messageMessageNoThe message that could be disposed of
handleCollect(...args):Promise<void>
Call this to handle an event as a collectable element. Accepts any event data as parameters.
NameTypeOptionalDescription
...argsunknown[]NoThe arguments emitted by the listener
Inherited from Collector
handleDispose(...args):Promise<void>
Call this to remove an element from the collection. Accepts any event data as parameters.
NameTypeOptionalDescription
...argsunknown[]NoThe arguments emitted by the listener
Inherited from Collector
on(event, listener):this
NameTypeOptionalDescription
eventEventKeyNoNone
listener(...args: CollectorEventTypes<K, V, F>[EventKey]) => Awaitable<void>NoNone
Inherited from Collector
once(event, listener):this
NameTypeOptionalDescription
eventEventKeyNoNone
listener(...args: CollectorEventTypes<K, V, F>[EventKey]) => Awaitable<void>NoNone
Inherited from Collector
resetTimer(options?):void
Resets the collector's timeout and idle timer.
NameTypeOptionalDescription
optionsCollectorResetTimerOptionsYesOptions for resetting
Inherited from Collector
stop(reason?):void
Stops this collector and emits the end event.
NameTypeOptionalDescription
reasonstringYesThe reason this collector is ending
Inherited from Collector
toJSON():unknown