InteractionCollector class

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

const interactionCollector = new InteractionCollector(data: object, message: Message, addon: Addon);

constructor

The InteractionCollector class requires three arguments. The first argument is an object with information about requirements which the interactions 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 interactions of. The third argument must be an instance of the Zyno Bot Addons Addon class and defines the addon where the InteractionCollector class must be created for.

The data object may contain the following information:

  • filter: A function with one parameter, a ButtonInteraction class or MenuInteraction class, which can be used to set certain requirements for the interactions which should be collected.

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

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

Properties

id

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

count

The amount of interactions that have been collected by the collector.

max

The maximum amount of interactions the collector may collect.

filter

A function which the collector uses to check if whether the interaction 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 interactions.

Functions

stop

interactionCollector.stop() : void;

Forces the InteractionCollector to stop with collecting new interactions.

Events

EventDescriptionArguments

collect

Gets emitted when a new interaction has been collected by the InteractionCollector

ButtonIntneraction or MenuIntneraction

end

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

This event doesn't return any arguments.

Last updated