Controller

Controller

Reaction Controller class

Constructor

new Controller(botMessage, collector, pages) → {Controller}

Reaction Controller constructor

Source:
Parameters:
Name Type Description
botMessage Message

Message where reaction collector is working.

collector Discord.ReactionCollector

Collector from botMessage.

pages Object

All reaction collector pages.

Returns:
Type:
Controller

Members

(readonly) botMessage :Message

Bot message of reaction collector.

Source:
Type:
  • Message

(readonly) canBack :boolean

Can use funcion back()?

Source:
Type:
  • boolean

(readonly) collector :Discord.ReactionCollector

Discord.js reaction collector

Source:
Type:
  • Discord.ReactionCollector

(readonly) currentPage :Object

Current page.

Source:
Type:
  • Object

(readonly, nullable) lastPage :Object

Last page visualized by user.

Source:
Type:
  • Object

(readonly, nullable) messagesCollector :Discord.MessageCollector

Discord.js message collector, if pages have funcion to catch messages.

Source:
Type:
  • Discord.MessageCollector

(readonly) pages :Object

All pages Object

Source:
Type:
  • Object

Methods

(async) back() → {Promise.<void>}

Back to last page

Source:
Throws:
  • Invalid action if tou cannot back without a last page valid.
Type
string
Returns:
Type:
Promise.<void>

(async) goTo(pageId) → {Promise.<void>}

Go to other page

Source:
Parameters:
Name Type Description
pageId string | number

Specific ID to other page.

Throws:

Invalid action if page id given doesn't exists.

Type
string
Returns:
Type:
Promise.<void>

resetTimer(optionsopt) → {void}

Reset collectors timer

Source:
Parameters:
Name Type Attributes Description
options Object <optional>
Name Type Attributes Description
time number <optional>

How long to run the collector for in milliseconds.

idle number <optional>

How long to stop the collector after inactivity in milliseconds.

Returns:
Type:
void

stop(reasonopt, nullable) → {void}

Stop all collectors funcion

Source:
Parameters:
Name Type Attributes Default Description
reason string <optional>
<nullable>
'user'

The reason this collector is ending

Returns:
Type:
void

(async) update(onlyMessageopt) → {Promise.<void>}

Update botMessage when page was changed.

Source:
Parameters:
Name Type Attributes Default Description
onlyMessage boolean <optional>
false

Do you need update only message, without reactions? Default false.

Returns:
Type:
Promise.<void>