InteractionOptions

Create a formatted Interaction Options Object

Constructor

new InteractionOptions() → {InteractionOptions}

Returns:
Type: 
InteractionOptions
Example
const subCommandOption = interaction.options.getSubCommand(); // returns the subcommand option
const subCommandGroupOption = interaction.options.getSubCommandGroup(); // returns the subcommand group option
const stringOption = interaction.options.getStringOption("optionName"); // returns the string option
const integerOption = interaction.options.getIntegerOption("optionName"); // returns the integer option
const booleanOption = interaction.options.getBooleanOption("optionName"); // returns the boolean option
const userOption = interaction.options.getUserOption("optionName"); // returns the user option
const memberOption = interaction.options.getMemberOption("optionName"); // returns the member option
const channelOption = interaction.options.getChannelOption("optionName"); // returns the channel option
const roleOption = interaction.options.getRoleOption("optionName"); // returns the role option
const numberOption = interaction.options.getNumberOption("optionName"); // returns the number option
const mentionableOption = interaction.options.getMentionableOption("optionName"); // returns the mentionable option

Members

data :Array.<object>

the interaction option data

Type:
  • Array.<object>

Methods

getAttachmentOption() → {InteractionOptionsType.structure}

Get the interaction option "Attachment"

Properties
NameTypeDescription
namestring

The name of the option

Returns:
Type: 
InteractionOptionsType.structure
Example
const attachmentOption = interaction.options.getAttachmentOption("optionName"); // returns the attachment

getBooleanOption() → {InteractionOptionsType.structure}

Get the interaction option "Boolean"

Properties
NameTypeDescription
namestring

The name of the option

Returns:
Type: 
InteractionOptionsType.structure
Example
const booleanOption = interaction.options.getBooleanOption("optionName"); // returns the boolean

getChannelOption() → {InteractionOptionsType.structure}

Get the interaction option "Channel"

Properties
NameTypeDescription
namestring

The name of the option

Returns:
Type: 
InteractionOptionsType.structure
Example
const channelOption = interaction.options.getChannelOption("optionName"); // returns the channel

getIntegerOption() → {InteractionOptionsType.structure}

Get the interaction option "String"

Properties
NameTypeDescription
namestring

The name of the option

Returns:
Type: 
InteractionOptionsType.structure
Example
const integerOption = interaction.options.getIntegerOptionOption("optionName"); // returns the integer

getMentionableOption() → {InteractionOptionsType.structure}

Get the interaction option "Mentionable"

Properties
NameTypeDescription
namestring

The name of the option

Returns:
Type: 
InteractionOptionsType.structure
Example
const mentionableOption = interaction.options.getMentionableOption("optionName"); // returns the mentionable

getNumberOption() → {InteractionOptionsType.structure}

Get the interaction option "Number"

Properties
NameTypeDescription
namestring

The name of the option

Returns:
Type: 
InteractionOptionsType.structure
Example
const numberOption = interaction.options.getNumberOption("optionName"); // returns the number

getOptions() → {Array.<object>}

Get the interaction options

Returns:
Type: 
Array.<object>
Example
const options = interaction.options.getOptions(); // returns the options

getRoleOption() → {InteractionOptionsType.structure}

Get the interaction option "Role"

Properties
NameTypeDescription
namestring

The name of the option

Returns:
Type: 
InteractionOptionsType.structure
Example
const roleOption = interaction.options.getRoleOption("optionName"); // returns the role

getStringOption() → {InteractionOptionsType.structure}

Get the interaction option "String"

Properties
NameTypeDescription
namestring

The name of the option

Returns:
Type: 
InteractionOptionsType.structure
Example
const stringOption = interaction.options.getStringOption("optionName"); // returns the string

getSubCommand() → {InteractionOptionsType.structure}

Get the interaction option "Sub Command"

Properties
NameTypeDescription
namestring

The name of the option

Returns:
Type: 
InteractionOptionsType.structure
Example
const subCommandOption = interaction.options.getSubCommand(); // returns the subcommand

getSubCommandGroup() → {InteractionOptionsType.structure}

Get the interaction option "Sub Command Group"

Properties
NameTypeDescription
namestring

The name of the option

Returns:
Type: 
InteractionOptionsType.structure
Example
const subCommandGroupOption = interaction.options.getSubCommandGroup(); // returns the subcommand group

getUserOption() → {InteractionOptionsType.structure}

Get the interaction option "User"

Properties
NameTypeDescription
namestring

The name of the option

Returns:
Type: 
InteractionOptionsType.structure
Example
const userOption = interaction.options.getUserOption("optionName"); // returns the user