class MessageCollector

export class MessageCollector extends Collector<Snowflake, Message, [Collection<Snowflake, Message>]>

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

Constructors

constructor()

channel : TextBasedChannel

The channel

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

filter : CollectorFilter

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

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

received : number

Total number of messages that were received in the channel during message collection

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

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(
message: Message
) : Snowflake | null

Handles a message for possible collection.

dispose(
message: Message
) : Snowflake | null

Handles a message for possible disposal.

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

on<

EventKey extends keyof CollectorEventTypes<Snowflake, Message, [>

>(
event: EventKey
listener: (...args: CollectorEventTypes<Snowflake, Message, [>[EventKey]) => Awaitable<void>
) : this

Inherited from: Collector

once<

EventKey extends keyof CollectorEventTypes<Snowflake, Message, [>

>(
event: EventKey
listener: (...args: CollectorEventTypes<Snowflake, Message, [>[EventKey]) => Awaitable<void>
) : this

Inherited from: Collector

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(
message: Message
)

Emitted whenever a message is collected.

dispose(
message: Message
)

Emitted whenever a message is disposed of.

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.