export abstract class Collector<Key, Value, Extras extends unknown[] = []> extends EventEmitter
Abstract class for defining a new Collector.
Constructors
client: Client<true>options?: CollectorOptions<[Value, ...Extras]>)
constructor(Constructs a new instance of the Collector
class
Type Parameters
readonlyClient client :
The client that instantiated this Collector
Collection<Key, Value> collected :
The items collected by this collector
boolean ended :
Whether this collector has finished collecting
The reason this collector has ended with, or null if it hasn't ended yet
CollectorFilter<[Value, ...Extras]> filter :
The filter applied to this collector
readonlyPromise<Value> next :
Returns a promise that resolves with the next collected element; rejects with collected elements if the collector finishes without receiving a next element
CollectorOptions<[Value, ...Extras]> options :
The options of this collector
[Symbol.asyncIterator]AsyncIterableIterator<[Value, ...Extras]> () :
checkEndboolean () :
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.
onEventKey extends keyof CollectorEventTypes<Key, Value, Extras>
>(event: EventKeylistener: (...args: CollectorEventTypes<Key, Value, Extras>[EventKey]) => void) : this <
EventKey extends keyof CollectorEventTypes<Key, Value, Extras>
onceEventKey extends keyof CollectorEventTypes<Key, Value, Extras>
>(event: EventKeylistener: (...args: CollectorEventTypes<Key, Value, Extras>[EventKey]) => void) : this <
EventKey extends keyof CollectorEventTypes<Key, Value, Extras>
resetTimeroptions?: CollectorResetTimerOptions) : void (
Resets the collector's timeout and idle timer.
toJSONunknown () :
collectargs: any) (
Emitted whenever an element is collected.
disposeargs: any) (
Emitted whenever an element is disposed of.
endcollected: Collectionreason: string) (
Emitted when the collector is finished collecting.
ignoreargs: any) (
Emitted whenever an element is not collected by the collector.