SelectMenu - Bilal2453/discordia-components GitHub Wiki
Component
extendsRepresents a Component of type SelectMenu. SelectMenus are interactive message components that offers the user multiple choices form, once one is selected an interactionCreate event is fired.
For accepted data
fields see SelectMenu-Resolvable.
General rules you should follow:
- Only a single SelectMenu can be sent in each Action Row.
- SelectMenu and Buttons cannot be in the same row.
Constructor
SelectMenu(data)
Parameter | Type |
---|---|
data | SelectMenu-Resolvable |
Component
Properties Inherited FromName | Type | Description |
---|---|---|
actionRow | number | The Action Row this component is using. |
disabled | boolean | Whether the current component is disabled or not. |
id | string | The component custom_id. Nil for some components such as Link Buttons. |
type | number | The component type. See componentType enumeration for further info. |
Component
Methods Inherited Fromdisable()
Sets the disabled
field to true
.
Returns self.
This method only operates on data in memory.
Returns: Component
enable()
Sets the disabled
field to false
.
Returns self.
This method only operates on data in memory.
Returns: Component
get(property)
Parameter | Type |
---|---|
property | string |
Returns the value of the provided property
name.
This method only operates on data in memory.
Returns: any
raw()
Returns a table value of what the raw value Discord would accept is like based on assumptions of the current component's field names.
By design, user should never need to use this method.
This method only operates on data in memory.
Returns: table
set(property, value)
Parameter | Type | Optional |
---|---|---|
property | string/table | |
value | any | ✔ |
Sets the provided field(s) value. If property
is a table, value
is ignored;
the key of an entry is treated as the field name, and its value is the field's value.
Otherwise if property
is a string, value
is required.
Keep in mind this will validate the inputs and error if not valid.
This method only operates on data in memory.
Returns: Component
Methods
maxValues(val)
Parameter | Type |
---|---|
val | number |
The upmost amount of options to be selected. Must be in range val
<= 25.
Returns self.
This method only operates on data in memory.
Returns: SelectMenu
minValues(val)
Parameter | Type |
---|---|
val | number |
The least required amount of options to be selected. Must be in range 0 < val
<= 25.
Returns self.
This method only operates on data in memory.
Returns: SelectMenu
option(label, value, description, default, emoji)
Parameter | Type | Optional |
---|---|---|
label | table/string | |
value | string | |
description | string | ✔ |
default | boolean | ✔ |
emoji | Emoji-Resolvable | ✔ |
Creates a new option in the menu with the provided values.
If label
is a table you should pass rest of parameters as fields in that table, the only required fields are label
and value
.
Returns self.
This method only operates on data in memory.
Returns: SelectMenu
options(options)
Parameter | Type |
---|---|
options | table |
Overrides current options with the ones provided. options
is an array of tables (25 at most),
each representing an option, available fields for each option are: label
and value
required,
description
, default
, emoji
optional; See option method's parameters for more info.
Returns self.
This method only operates on data in memory.
Returns: SelectMenu
placeholder(placeholder)
Parameter | Type |
---|---|
placeholder | string |
A placeholder in case nothing is specified.
Returns self.
This method only operates on data in memory.
Returns: SelectMenu