Skip to content

ChannelSelect

ChannelSelect

Class representing a Channel Select component for Discord message components.

Kind: global class

new ChannelSelect(data)

Creates a new instance of the ChannelSelect class.

ParamTypeDescription
dataObjectThe data to initialize the channel select component with.
data.custom_idstringThe unique identifier for the component.
data.optionsArrayThe options for the select component.
data.options.labelObjectThe label for the option.
data.options.valueObjectThe value for the option.
data.options.descriptionObjectThe description for the option.
data.options.emojiObjectThe emoji for the option.
data.options.defaultbooleanWhether the option is the default option.
data.placeholderstringThe placeholder text for the select component.
data.min_valuesnumberThe minimum number of options that can be selected.
data.max_valuesnumberThe maximum number of options that can be selected.
data.disabledbooleanWhether the component is disabled.

channelSelect.setCustomId(customId) ⇒ ChannelSelect

Sets the custom ID of the select component.

Kind: instance method of ChannelSelect
Returns: ChannelSelect - The ChannelSelect instance.

ParamTypeDescription
customIdstringThe custom ID to set.

channelSelect.setPlaceholder(placeholder) ⇒ ChannelSelect

Sets the placeholder text of the select component.

Kind: instance method of ChannelSelect
Returns: ChannelSelect - The ChannelSelect instance.

ParamTypeDescription
placeholderstringThe placeholder text to set.

channelSelect.setMinValues(minValue) ⇒ ChannelSelect

Set the minimum number of options that can be selected.

Kind: instance method of ChannelSelect
Returns: ChannelSelect - The ChannelSelect instance.

ParamTypeDescription
minValuenumberThe minimum number of options that can be selected.

channelSelect.setMaxValues(maxValue) ⇒ ChannelSelect

Set the maximum number of options that can be selected.

Kind: instance method of ChannelSelect
Returns: ChannelSelect - The ChannelSelect instance.

ParamTypeDescription
maxValuenumberThe maximum number of options that can be selected.

channelSelect.setDisabled(maxValue) ⇒ ChannelSelect

Set the maximum number of options that can be selected.

Kind: instance method of ChannelSelect
Returns: ChannelSelect - The ChannelSelect instance.

ParamTypeDescription
maxValuenumberThe maximum number of options that can be selected.

channelSelect.setOptions(options) ⇒ ChannelSelect

Set the options for the select menu.

Kind: instance method of ChannelSelect
Returns: ChannelSelect - The ChannelSelect instance.

ParamTypeDescription
optionsArray.<Object>An array of option objects for the select menu.

channelSelect.toJSON() ⇒ Object

Convert the ChannelSelect instance to a plain object for sending to Discord API.

Kind: instance method of ChannelSelect
Returns: Object - The plain object representation of the ChannelSelect.

ChannelSelect.transformOptions(options) ⇒ Object

Transforms the given options data into a format compatible with the select component.

Kind: static method of ChannelSelect
Returns: Object - The transformed options data.

ParamTypeDescription
optionsObjectThe options data to transform.
options.labelstringThe label for the option.
options.valuestringThe value for the option.
options.descriptionstringThe description for the option.
options.emojistringThe emoji for the option.
options.defaultbooleanWhether the option is the default option.

ChannelSelect.transformEmoji(emoji) ⇒ Object

Transforms the given emoji data into a format compatible with the select component.

Kind: static method of ChannelSelect
Returns: Object - The transformed emoji data.

ParamTypeDescription
emojiObject | stringThe emoji data to transform.
emoji.namestringThe name of the emoji.
emoji.idstringThe ID of the emoji.
emoji.animatedbooleanWhether the emoji is animated.