SelectMenuOptionBuilder class

const selectMenuOption = new SelectMenuOptionBuilder(data:? object);

constructor

The SelectMenuOptionBuilder class provides one optional argument which is an object which provides the data for the SelectMenuOptionBuilder class.

The object may contain the following information:

  • label: The text which should be visible to the member on the option. The string must be between 1-100 characters.

  • value: A string which will be returned to the bot once the member selects this option. The string must be between 1-100 characters.

  • description: A description for the option so the member understands what your meanings are when the member selects this option. The string must be between 1-100 characters.

  • emoji: An object which defines the emoji which should be on the option, if you want an emoji on the option. The object should provide whether the emoji is animated or not, the id of the emoji and the name of the emoji.

  • default: A boolean which defines whether the option should be the default option or not.

Properties

data

An object which makes it a valid object for the Discord API.

{
    label: string;
    value: string;
    description?: string;
    emoji?: {
        animated: boolean;
        id?: string;
        name: string;
    }
    default: boolean;
}

Functions

setValue

selectMenuOption.setValue(value: string) : SelectMenuOptionBuilder;

Sets a value for the option which will be returned to the bot once the option was selected and makes you able to recognize which option was selected by the member. The function returns the same SelectMenuOptionBuilder class so you don't have to declare it everytime again.

ArgumentDescription

value

A string of max 100 characters which will be returned to the bot in the menuSelect event so you can recognize the option which was selected by the member.

setCustomId

selectMenuOption.setCustomId(customId: string) : SelectMenuOptionBuilder;

Identical to the setValue function. Sets a value for the option which will be returned to the bot once the option was selected and makes you able to recognize which option was selected by the member. The function returns the same SelectMenuOptionBuilder class so you don't have to declare it everytime again.

ArgumentDescription

value

A string of max 100 characters which will be returned to the bot in the menuSelect event so you can recognize the option which was selected by the member.

setLabel

selectMenuOption.setLabel(label: string) : SelectMenuOptionBuilder;

Sets a label for the option which is visible to server members. The function returns the same SelectMenuBuilder class so you don't have to declare it everytime again.

ArgumentDescription

label

A string of max 100 characters which should be the text on the option.

setText

selectMenuOption.setText(text: string) : SelectMenuBuilder;

Identical to the setLabel function. Sets a label for the option which is visible to server members. The function returns the same SelectMenuBuilder class so you don't have to declare it everytime again.

ArgumentDescription

text

A string of max 100 characters which should be the text on the option.

setEmoji

selectMenuOption.setEmoji(string | Emoji) : SelectMenuOptionBuilder;

Adds an emoji to the option. The emoji must be a unicode emoji or an instance of the Emoji class. The function returns the same SelectMenuOptionBuilder class so you don't have to declare it everytime again.

ArgumentDescription

emoji

The emoji which should be added to the option. The emoji must be a unicode emoji or an instance of the Emoji class.

setDefault

selectMenuOption.setDefault(defaultOption?: boolean) : SelectMenuOptionBuilder;

Defines whether the option should be the default option to select or not. The function returns the same SelectMenuOptionBuilder class so you don't have to declare it everytime again.

ArgumentDescription

defaultOption

A boolean which defines whether the option should be the default option to select or not.

setDescription

selectMenuOption.setDescription(description: string) : SelectMenuOptionBuilder;

Sets a description for the option which is visible to the member and can help the member understand what the option does when the member selects it. The function returns the same SelectMenuOptionBuilder class so you don't have to declare it everytime again.

ArgumentDescription

description

The description for the option which can help the member understand what the option does when the member selects it. The descripition may max be 100 characters.

toJSON

Converts the SelectMenuOptionBuilder class to an object to make it a valid object for the Discord API. The function returns the same data as the data property.

{
    label: string;
    value: string;
    description?: string;
    emoji?: {
        animated: boolean;
        id?: string;
        name: string;
    }
    default: boolean;
}

Last updated