Skip to main content
Version: 0.6.4

Class: ReactionCollector

Abstract class for defining a new Collector

Extends​

Constructors​

Constructor​

new ReactionCollector(message, options?): ReactionCollector

Parameters​

ParameterType
messageMessage
optionsReactionCollectorOptions

Returns​

ReactionCollector

Overrides​

Collector.constructor

Properties​

client​

readonly client: Client

Inherited from​

Collector.client


collected​

collected: Collection<string, MessageReaction>

Inherited from​

Collector.collected


ended​

ended: boolean = false

Inherited from​

Collector.ended


filter​

filter: (item, ...args) => boolean

Parameters​

ParameterType
itemMessageReaction
...argsany[]

Returns​

boolean

Inherited from​

Collector.filter


message​

message: Message


messageId​

messageId: string


options​

options: CollectorOptions<MessageReaction>

Inherited from​

Collector.options


total​

total: number = 0


users​

users: Set<string>

Methods​

[asyncIterator]()​

[asyncIterator](): AsyncIterableIterator<[string, MessageReaction]>

Allows iterating over collected items asynchronously.

Returns​

AsyncIterableIterator<[string, MessageReaction]>

Example​

for await (const [id, message] of collector) {
console.log(`Received message: ${message.content}`);
}

Inherited from​

Collector.[asyncIterator]


checkEnd()​

checkEnd(): void

Check if we should end upon collecting/disposing

Returns​

void

Inherited from​

Collector.checkEnd


collect()​

collect(reaction): string | null

Returns a key if the item should be collected, or null to skip

Parameters​

ParameterType
reactionMessageReaction

Returns​

string | null

Overrides​

Collector.collect


dispose()​

dispose(reaction): string | null

Returns a key if the item should be disposed, or null to skip

Parameters​

ParameterType
reactionMessageReaction

Returns​

string | null

Overrides​

Collector.dispose


endReason()​

endReason(): string | null

Check if there's a reason to end

Returns​

string | null

Overrides​

Collector.endReason


handleCollect()​

handleCollect(item, ...args): void

Evaluates an item and possibly passes it to the collector

Parameters​

ParameterType
itemMessageReaction
...argsany[]

Returns​

void

Inherited from​

Collector.handleCollect


handleDispose()​

handleDispose(item, ...args): void

Evaluates an item and possibly removes it from the collector

Parameters​

ParameterType
itemMessageReaction
...argsany[]

Returns​

void

Inherited from​

Collector.handleDispose


stop()​

stop(reason?): void

Stops the collector.

Parameters​

ParameterTypeDefault value
reasonstring"user"

Returns​

void

Inherited from​

Collector.stop