RoleSelect
Represents a Discord role select component that allows users to select one or more roles.
Kind: global class
- RoleSelect
- new RoleSelect([data])
- instance
- static
- .transformOptions(options) ⇒
Object - .transformEmoji(emoji) ⇒
Object
- .transformOptions(options) ⇒
new RoleSelect([data])
Section titled “new RoleSelect([data])”Create a role select component.
| Param | Type | Description |
|---|---|---|
| [data] | Object | The data to set in the component. |
| [data.custom_id] | string | The custom ID of the component. |
| [data.customId] | string | The custom ID of the component. |
| [data.options] | Array.<Object> | The options of the component. |
| [data.placeholder] | string | The placeholder text of the component. |
| [data.min_values] | number | The minimum number of values that can be selected. |
| [data.max_values] | number | The maximum number of values that can be selected. |
| [data.minValues] | number | The minimum number of values that can be selected. |
| [data.maxValues] | number | The maximum number of values that can be selected. |
| [data.disabled] | boolean | Whether the component is disabled or not. |
roleSelect.setCustomId(customId) ⇒ RoleSelect
Section titled “roleSelect.setCustomId(customId) ⇒ RoleSelect”Set the custom ID of the component.
Kind: instance method of RoleSelect
Returns: RoleSelect - The RoleSelect object.
| Param | Type | Description |
|---|---|---|
| customId | string | The custom ID to set. |
roleSelect.setPlaceholder(placeholder) ⇒ RoleSelect
Section titled “roleSelect.setPlaceholder(placeholder) ⇒ RoleSelect”Set the placeholder text of the component.
Kind: instance method of RoleSelect
Returns: RoleSelect - The RoleSelect object.
| Param | Type | Description |
|---|---|---|
| placeholder | string | The placeholder text to set. |
roleSelect.setMinValues(minValue) ⇒ RoleSelect
Section titled “roleSelect.setMinValues(minValue) ⇒ RoleSelect”Set the minimum number of values that can be selected.
Kind: instance method of RoleSelect
Returns: RoleSelect - The RoleSelect object.
| Param | Type | Description |
|---|---|---|
| minValue | number | The minimum number of values to set. |
roleSelect.setMaxValues(maxValue) ⇒ RoleSelect
Section titled “roleSelect.setMaxValues(maxValue) ⇒ RoleSelect”Set the maximum number of values that can be selected.
Kind: instance method of RoleSelect
Returns: RoleSelect - The RoleSelect object.
| Param | Type | Description |
|---|---|---|
| maxValue | number | The maximum number of values to set. |
roleSelect.setDisabled(disabled) ⇒ RoleSelect
Section titled “roleSelect.setDisabled(disabled) ⇒ RoleSelect”Set whether the component is disabled or not.
Kind: instance method of RoleSelect
Returns: RoleSelect - The RoleSelect object.
| Param | Type | Description |
|---|---|---|
| disabled | boolean | Whether the component is disabled or not. |
roleSelect.setOptions(options) ⇒ RoleSelect
Section titled “roleSelect.setOptions(options) ⇒ RoleSelect”Set the options of the component.
Kind: instance method of RoleSelect
Returns: RoleSelect - The RoleSelect object.
| Param | Type | Description |
|---|---|---|
| options | Array.<Object> | The options to set. |
roleSelect.toJSON() ⇒ Object
Section titled “roleSelect.toJSON() ⇒ Object”Returns the component data in the format expected by Discord’s API.
Kind: instance method of RoleSelect
Returns: Object - The component data.
RoleSelect.transformOptions(options) ⇒ Object
Section titled “RoleSelect.transformOptions(options) ⇒ Object”Transforms an option object into a format suitable for the component.
Kind: static method of RoleSelect
Returns: Object - The transformed option object.
| Param | Type | Description |
|---|---|---|
| options | Object | The option object to transform. |
| [options.label] | string | The text to display on the option. |
| [options.value] | string | The value to be sent to the server when the option is selected. |
| [options.description] | string | The text to display when hovering over the option. |
| [options.emoji] | string | Object | The emoji to display next to the option. |
| [options.default] | boolean | Whether the option should be selected by default. |
RoleSelect.transformEmoji(emoji) ⇒ Object
Section titled “RoleSelect.transformEmoji(emoji) ⇒ Object”Transforms an emoji to the structure expected by Discord’s API.
Kind: static method of RoleSelect
Returns: Object - The transformed emoji.
| Param | Type | Description |
|---|---|---|
| emoji | Object | The emoji to transform. |