InteractionCollector

export class InteractionCollector<T extends CollectedInteraction> extends Collector<
Snowflake,
T,
[Collection<Snowflake, T>]
>
export class InteractionCollector<T extends CollectedInteraction> extends Collector<
Snowflake,
T,
[Collection<Snowflake, T>]
>
Collects interactions. Will automatically stop if the message ( or ), channel (), or guild () is deleted. Interaction collectors that do not specify time or idle may be prone to always running. Ensure your interaction collectors end via either of these options or manual cancellation.
NameConstraintsOptionalDefaultDescription
TCollectedInteractionNoNone
constructor(client, options?)
NameTypeOptionalDescription
clientClient<true>NoNone
optionsInteractionCollectorOptions<T>YesNone
collect(interaction)
Emitted whenever an interaction is collected.
NameTypeOptionalDescription
interactionBaseInteractionNoThe interaction that was collected
dispose(interaction)
Emitted whenever an interaction is disposed of.
NameTypeOptionalDescription
interactionBaseInteractionNoThe interaction 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
channelId:Snowflake | null
The channel from which to collect interactions, if provided
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
componentType:ComponentType | null
The type of component to collect
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
guildId:Snowflake | null
The guild from which to collect interactions, if provided
interactionType:InteractionType | null
The type of interaction to collect
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
messageId:Snowflake | null
The message from which to collect interactions, if provided
messageInteractionId:Snowflake | null
The message interaction id from which to collect interactions, if provided
The options of this collector
total:number
The total number of interactions collected
The users that have interacted with this collector
[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(interaction):Snowflake
Handles an incoming interaction for possible collection.
Returns
NameTypeOptionalDescription
interactionInteractionNoThe interaction to possibly collect
dispose(interaction):Snowflake
Handles an interaction for possible disposal.
Returns
NameTypeOptionalDescription
interactionInteractionNoThe interaction that could be disposed of
empty():void
Empties this interaction collector.
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
event'collect' | 'dispose' | 'ignore'NoNone
listener(interaction: T) => Awaitable<void>NoNone
once(event, listener):this
NameTypeOptionalDescription
event'collect' | 'dispose' | 'ignore'NoNone
listener(interaction: T) => Awaitable<void>NoNone
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