CommandOption

CommandOption

Helps to create a choice for a command.

Methods

addChoice(choice) → {CommandOption}

Description:
  • Adds a choice to the option.

Source:
Parameters:
Name Type Description
choice CommandChoice

Adds a choice to the option.

Returns:
Type
CommandOption

addOption(option) → {CommandOption}

Description:
  • Adds an option to this option.

Source:
Parameters:
Name Type Description
option CommandOption

Adds an option to this option.

Returns:
Type
CommandOption

setAutocomplete(autocomplete) → {CommandOption}

Description:
  • Sets whether autocomplete is enabled for this option.

Source:
Parameters:
Name Type Description
autocomplete Boolean

Whether autocomplete is enabled for this option.

Returns:
Type
CommandOption

setChannelTypes(channelTypes) → {CommandOption}

Description:
  • Sets which channel types are selectable by the user.

Source:
See:
Parameters:
Name Type Description
channelTypes Array.<Number>

An array of channel types to offer as a choice.

Returns:
Type
CommandOption

setDefaultLocale(localenullable) → {Command}

Description:
  • Sets the default locale for localisation.

Source:
See:
Parameters:
Name Type Attributes Description
locale String <nullable>

Sets the default locale for localisation.

Returns:
Type
Command

setDescription(description) → {Command}

Description:
  • Sets the description of the command choice.

Source:
See:
Parameters:
Name Type Description
description String | Object

The description of the command choice, or an object of descriptions for localisation.

Returns:
Type
Command

setMaxLength(length) → {CommandOption}

Description:
  • Sets the maximum length the user may enter.

Source:
Parameters:
Name Type Description
length Number

The maximum length that the user may enter.

Returns:
Type
CommandOption

setMaxValue(value) → {CommandOption}

Description:
  • Sets the maximum value the user may enter.

Source:
Parameters:
Name Type Description
value Number

The maximum number value that the user may enter.

Returns:
Type
CommandOption

setMinLength(length) → {CommandOption}

Description:
  • Sets the minimum length the user may enter.

Source:
Parameters:
Name Type Description
length Number

The minimum length that the user may enter.

Returns:
Type
CommandOption

setMinValue(value) → {CommandOption}

Description:
  • Sets the minimum value the user may enter.

Source:
Parameters:
Name Type Description
value Number

The minimum number value that the user may enter.

Returns:
Type
CommandOption

setName(name) → {CommandOption}

Description:
  • Sets the name of the option.

Source:
Parameters:
Name Type Description
name String | Object

Sets the name of the option, or an object of names for localisation.

Returns:
Type
CommandOption

setRequired(isRequired) → {CommandOption}

Description:
  • Sets whether the option is required.

Source:
Parameters:
Name Type Description
isRequired Boolean

Whether the option is required.

Returns:
Type
CommandOption

setType(type) → {Command}

Description:
  • Sets the option type.

Source:
See:
Parameters:
Name Type Description
type Number

The option type.

Returns:
Type
Command

toJSON() → {Object}

Description:
  • Returns the correct Discord format for a command option.

Source:
Returns:
Type
Object