Skip to content

SlashOption

SlashOption ⇐ Base

Represents a slash command option.

Kind: global class
Extends: Base
Properties

NameTypeDescription
typestringThe type of the option.
namestringThe name of the option.
descriptionstringThe description of the option.
requiredbooleanWhether the option is required or not.
choicesArray.<Object>The choices available for the option.
channelTypesArray.<string>The types of channels the option can be used in.
minValuenumber

new SlashOption([data], client)

Constructs a new instance of the SlashOption class.

ParamTypeDescription
[data]ObjectThe data object containing the option properties.
clientClientThe client object.

SlashOption.transformChoices(o) ⇒ Object

Transforms an object into a new object with the properties “name” and “value”. If the original object does not have a “name” or “value” property, the corresponding property in the new object will be set to undefined.

Kind: static method of SlashOption
Returns: Object - - The transformed object with “name” and “value” properties.

ParamTypeDescription
oObjectThe original object to transform.

SlashOption.transformChannelTypes(channel) ⇒ string | object

Transforms the channel type from a number to its corresponding string representation.

Kind: static method of SlashOption
Returns: string | object - - The transformed channel type.

ParamTypeDescription
channelnumber | objectThe channel type to transform. If it is a number, it will be converted to its string representation. If it is an object, it will be returned as is.