Skip to content

RoleSelect

RoleSelect

Represents a Discord role select component that allows users to select one or more roles.

Kind: global class

new RoleSelect([data])

Create a role select component.

ParamTypeDescription
[data]ObjectThe data to set in the component.
[data.custom_id]stringThe custom ID of the component.
[data.customId]stringThe custom ID of the component.
[data.options]Array.<Object>The options of the component.
[data.placeholder]stringThe placeholder text of the component.
[data.min_values]numberThe minimum number of values that can be selected.
[data.max_values]numberThe maximum number of values that can be selected.
[data.minValues]numberThe minimum number of values that can be selected.
[data.maxValues]numberThe maximum number of values that can be selected.
[data.disabled]booleanWhether the component is disabled or not.

roleSelect.setCustomId(customId) ⇒ RoleSelect

Set the custom ID of the component.

Kind: instance method of RoleSelect
Returns: RoleSelect - The RoleSelect object.

ParamTypeDescription
customIdstringThe custom ID to set.

roleSelect.setPlaceholder(placeholder) ⇒ RoleSelect

Set the placeholder text of the component.

Kind: instance method of RoleSelect
Returns: RoleSelect - The RoleSelect object.

ParamTypeDescription
placeholderstringThe placeholder text to set.

roleSelect.setMinValues(minValue) ⇒ RoleSelect

Set the minimum number of values that can be selected.

Kind: instance method of RoleSelect
Returns: RoleSelect - The RoleSelect object.

ParamTypeDescription
minValuenumberThe minimum number of values to set.

roleSelect.setMaxValues(maxValue) ⇒ RoleSelect

Set the maximum number of values that can be selected.

Kind: instance method of RoleSelect
Returns: RoleSelect - The RoleSelect object.

ParamTypeDescription
maxValuenumberThe maximum number of values to set.

roleSelect.setDisabled(disabled) ⇒ RoleSelect

Set whether the component is disabled or not.

Kind: instance method of RoleSelect
Returns: RoleSelect - The RoleSelect object.

ParamTypeDescription
disabledbooleanWhether the component is disabled or not.

roleSelect.setOptions(options) ⇒ RoleSelect

Set the options of the component.

Kind: instance method of RoleSelect
Returns: RoleSelect - The RoleSelect object.

ParamTypeDescription
optionsArray.<Object>The options to set.

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

Transforms an option object into a format suitable for the component.

Kind: static method of RoleSelect
Returns: Object - The transformed option object.

ParamTypeDescription
optionsObjectThe option object to transform.
[options.label]stringThe text to display on the option.
[options.value]stringThe value to be sent to the server when the option is selected.
[options.description]stringThe text to display when hovering over the option.
[options.emoji]string | ObjectThe emoji to display next to the option.
[options.default]booleanWhether the option should be selected by default.

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.

ParamTypeDescription
emojiObjectThe emoji to transform.