InteractionCollector

export class InteractionCollector<Interaction extends CollectedInteraction> extends Collector<Snowflake, Interaction, [Collection<Snowflake, Interaction>]>
export class InteractionCollector<Interaction extends CollectedInteraction> extends Collector<Snowflake, Interaction, [Collection<Snowflake, Interaction>]>
Collects interactions. Will automatically stop if the message (messageDelete or messageDeleteBulk), channel (channelDelete), or guild (guildDelete) 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.

Extends

Collector<Snowflake, Interaction, [Collection<Snowflake, Interaction>]>
NameConstraintsOptionalDefaultDescription
InteractionCollectedInteractionNoNone
constructor(client, options?)
NameTypeOptionalDescription
clientClient<true>NoNone
optionsInteractionCollectorOptions<Interaction>YesNone
collect
Emitted whenever an interaction is collected.
NameTypeOptionalDescription
interactionBaseInteractionNoThe interaction that was collected
dispose
Emitted whenever an interaction is disposed of.
NameTypeOptionalDescription
interactionBaseInteractionNoThe interaction that was disposed of
end
Emitted when the collector is finished collecting.
NameTypeOptionalDescription
collectedCollectionNoThe elements collected by the collector
reasonstringNoThe reason the collector ended
ignore
Emitted whenever an element is not collected by the collector.
NameTypeOptionalDescription
argsanyNoThe 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<Snowflake, Interaction>
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<[Interaction, ...[]>
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
options:InteractionCollectorOptions<Interaction>
The options of this collector
total:number
The total number of interactions collected
The users that have interacted with this collector
[Symbol.asyncIterator]():AsyncIterableIterator<[Interaction, ...[]>
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: Interaction) => voidNoNone
once(event, listener):this
NameTypeOptionalDescription
event'collect' | 'dispose' | 'ignore'NoNone
listener(interaction: Interaction) => voidNoNone
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