export abstract class Collector<Key, Value, Extras extends unknown[] = []> extends EventEmitterAbstract class for defining a new Collector.
Constructors
constructor(client: Client<true>options?: CollectorOptions<[Value, ...Extras]>)
Constructs a new instance of the Collector class
Type Parameters
readonlyclient : Client
The client that instantiated this Collector
collected : Collection<Key, Value>
The items collected by this collector
ended : boolean
Whether this collector has finished collecting
The reason this collector has ended with, or null if it hasn't ended yet
filter : CollectorFilter<[Value, ...Extras]>
The filter applied to this collector
Returns a promise that resolves with the next collected element; rejects with collected elements if the collector finishes without receiving a next element
options : CollectorOptions<[Value, ...Extras]>
The options of this collector
[Symbol.asyncIterator]() : AsyncIterableIterator<[Value, ...Extras]>
checkEnd() : boolean
Checks whether the collector should end, and if so, ends it.
Returns: Whether the collector ended or not
Handles incoming events from the handleCollect function. Returns null if the event should not be collected, or returns an object describing the data that should be stored.
Returns: Data to insert into collection, if any
Handles incoming events from the handleDispose. Returns null if the event should not be disposed, or returns the key that should be removed.
Returns: Key to remove from the collection, if any
Call this to handle an event as a collectable element. Accepts any event data as parameters.
Call this to remove an element from the collection. Accepts any event data as parameters.
on<EventKey extends keyof CollectorEventTypes<Key, Value, Extras>
>(event: EventKeylistener: (...args: CollectorEventTypes<Key, Value, Extras>[EventKey]) => void) : this
EventKey extends keyof CollectorEventTypes<Key, Value, Extras>
once<EventKey extends keyof CollectorEventTypes<Key, Value, Extras>
>(event: EventKeylistener: (...args: CollectorEventTypes<Key, Value, Extras>[EventKey]) => void) : this
EventKey extends keyof CollectorEventTypes<Key, Value, Extras>
resetTimer(options?: CollectorResetTimerOptions) : void
Resets the collector's timeout and idle timer.
toJSON() : unknown
collect(args: any)
Emitted whenever an element is collected.
dispose(args: any)
Emitted whenever an element is disposed of.
end(collected: Collectionreason: string)
Emitted when the collector is finished collecting.
ignore(args: any)
Emitted whenever an element is not collected by the collector.