EmojiCollector class

The EmojiCollector class extends the NodeJS built-in EventEmitter class.

const emojiCollector = new EmojiCollector(data: object, message: Message, addon: Addon);

constructor

The EmojiCollector class requires three arguments. The first argument is an object with information about requirements which the reactions must meet to be collected. The second argument must be an instance of the Zyno Bot Addons Message class which defines the message where the collector must collect reactions of. The third argument must be an instance of the Zyno Bot Addons Addon class and defines the addon where the EmojiCollector class must be created for.

The data object may contain the following information:

  • filter: A function with two parameters, a Reaction class and a User class, which can be used to set certain requirements for the reactions which should be collected.

  • max: A number which defines the maximum amount of reactions the bot may collect.

  • time: A number which defines the amount of milliseconds after the bot should stop collecting reactions.

Properties

id

A unique id where the EmojiCollector class can be defined with.

count

The amount of emoji's that have been collected by the collector.

max

The maximum amount of emoji's the collector may collect.

filter

A function which the collector uses to check if whether the reaction meets certain requirements set by the creator of the addon.

time

A number which represents the timestamp of the time when the collector automatically stops collecting any emoji's.

Functions

stop

emojiCollector.stop() : void;

Forces the EmojiCollector to stop with collecting new reactions.

Events

EventDescriptionArguments

collect

Gets emitted when a new reaction has been collected by the EmojiCollector

end

Gets emitted when the EmojiCollector stops collecting new reactions, due to reaching the maximum amount of reactions, exceeding the ending time or due to a call to the stop function.

This event doesn't return any arguments.

Last updated