Page - object-Object/discordia-reaction-menu GitHub Wiki
This page details how to properly create a Page object using rm.Page()
.
Properties
Property | Type | Optional | Autogenerated | Description |
---|---|---|---|---|
choices | table | ✔ | Table of up to 9 Choice objects. This or getChoices may be provided, but not both. |
|
color | string | ✔ | ✔ (if not provided) | The color of the embed, in the form of a 6 digit hex number. Defaults to 00ff00 . |
description | string | ✔ | A text description to go above the choices. This or getDescription may be provided, but not both. |
|
inHistory | boolean | ✔ | ✔ (if not provided) | Whether or not this page should be added to the menu's history (i.e. if the back button should go back to this page). Defaults to true , unless onPrompt exists, in which case it defaults to false . |
title | string | Title of the page's embed. This or getTitle may be provided, but not both. |
||
type | string | ✔ | The type of the object. |
Methods
getChoices(self, menu, data)
Parameter | Type |
---|---|
self | Page |
menu | Menu |
data | table |
Can be used to include dynamic variables in the choices, or to generate choices on-the-fly. This or choices
may be provided, but not both. Should return a table of the choices to be displayed.
Returns: table
getDescription(self, menu, data)
Parameter | Type |
---|---|
self | Page |
menu | Menu |
data | table |
Can be used to include dynamic variables in the description. This or description
may be provided, but not both. Should return the description.
Returns: string
getTitle(self, menu, data)
Parameter | Type |
---|---|
self | Page |
menu | Menu |
data | table |
Can be used to include dynamic variables in the title. This or title
may be provided, but not both. Should return the title.
Returns: string
onBack(self, menu, data)
Parameter | Type |
---|---|
self | Page |
menu | Menu |
data | table |
Overrides the behaviour of the back button for this page. Returns the next page to go to, or true
to go back to the previous page (default behaviour).
Returns: Page
onPrompt(self, menu, data, message)
Parameter | Type |
---|---|
self | Page |
menu | Menu |
data | table |
message | Message |
Turns the page into a prompt if present. Called when a message is received from the user who opened the page. Returns the next page to go to, or true
to go back to the previous page. Unless inHistory
is manually set to true
, prompt pages will not be added to the menu history.
Returns: Page