Class: InteractionOptionResolver
Utility class for resolving command interaction options while working with the raw API. Based on https://github.com/discordjs/discord.js/blob/main/packages/discord.js/src/structures/CommandInteractionOptionResolver.js
Constructors
new InteractionOptionResolver()
new InteractionOptionResolver(
interaction:APIApplicationCommandInteraction|APIApplicationCommandAutocompleteInteraction|APIModalSubmitInteraction):InteractionOptionResolver
Parameters
| Parameter | Type |
|---|---|
interaction | APIApplicationCommandInteraction | APIApplicationCommandAutocompleteInteraction | APIModalSubmitInteraction |
Returns
Source
projects/utilities/packages/discord-utilities/src/lib/InteractionOptionResolver.ts:61
Properties
data
privatereadonlydata:null|APIApplicationCommandInteractionDataOption[] =null
The interaction options array
Source
projects/utilities/packages/discord-utilities/src/lib/InteractionOptionResolver.ts:34
group
privatereadonlygroup:null|string=null
The name of the subcommand group
Source
projects/utilities/packages/discord-utilities/src/lib/InteractionOptionResolver.ts:54
hoistedOptions
privatereadonlyhoistedOptions:null|APIApplicationCommandInteractionDataOption[] =null
Bottom-level options for the interaction If there is a subcommand (or subcommand and group), this represents the options for the subcommand.
Source
projects/utilities/packages/discord-utilities/src/lib/InteractionOptionResolver.ts:49
interaction
privatereadonlyinteraction:APIApplicationCommandInteraction|APIApplicationCommandAutocompleteInteraction|APIModalSubmitInteraction
Source
projects/utilities/packages/discord-utilities/src/lib/InteractionOptionResolver.ts:29
resolved
privatereadonlyresolved:null|APIInteractionDataResolved|APIUserInteractionDataResolved|APIMessageApplicationCommandInteractionDataResolved=null
The interaction resolved data
Source
projects/utilities/packages/discord-utilities/src/lib/InteractionOptionResolver.ts:39
subcommand
privatereadonlysubcommand:null|string=null
The name of the subcommand
Source
projects/utilities/packages/discord-utilities/src/lib/InteractionOptionResolver.ts:59
Methods
get()
get(name, required)
get(
name:string,required?:boolean):null|APIApplicationCommandInteractionDataOption
Gets an option by its name
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The name of the option |
required? | boolean | Whether to throw an error if the option is not found |
Returns
null | APIApplicationCommandInteractionDataOption
Source
projects/utilities/packages/discord-utilities/src/lib/InteractionOptionResolver.ts:83
get(name, required)
get(
name:string,required:true):APIApplicationCommandInteractionDataOption
Gets an option by its name
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The name of the option |
required | true | Whether to throw an error if the option is not found |
Returns
APIApplicationCommandInteractionDataOption
Source
projects/utilities/packages/discord-utilities/src/lib/InteractionOptionResolver.ts:84
getAttachment()
getAttachment(name, required)
getAttachment(
name:string,required?:boolean):null|APIAttachment
Gets an attachment option
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The name of the option |
required? | boolean | Whether to throw an error if the option is not found |
Returns
null | APIAttachment
Source
projects/utilities/packages/discord-utilities/src/lib/InteractionOptionResolver.ts:238
getAttachment(name, required)
getAttachment(
name:string,required:true):APIAttachment
Gets an attachment option
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The name of the option |
required | true | Whether to throw an error if the option is not found |
Returns
APIAttachment
Source
projects/utilities/packages/discord-utilities/src/lib/InteractionOptionResolver.ts:239
getBoolean()
getBoolean(name, required)
getBoolean(
name:string,required?:boolean):null|boolean
Gets a boolean option
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The name of the option |
required? | boolean | Whether to throw an error if the option is not found |
Returns
null | boolean
Source
projects/utilities/packages/discord-utilities/src/lib/InteractionOptionResolver.ts:134
getBoolean(name, required)
getBoolean(
name:string,required:true):boolean
Gets a boolean option
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The name of the option |
required | true | Whether to throw an error if the option is not found |
Returns
boolean
Source
projects/utilities/packages/discord-utilities/src/lib/InteractionOptionResolver.ts:135
getChannel()
getChannel(name, required)
getChannel(
name:string,required?:boolean):null|APIInteractionDataResolvedChannel
Gets a channel option
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The name of the option |
required? | boolean | Whether to throw an error if the option is not found |
Returns
null | APIInteractionDataResolvedChannel
Source
projects/utilities/packages/discord-utilities/src/lib/InteractionOptionResolver.ts:147
getChannel(name, required)
getChannel(
name:string,required:true):APIInteractionDataResolvedChannel
Gets a channel option
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The name of the option |
required | true | Whether to throw an error if the option is not found |
Returns
APIInteractionDataResolvedChannel
Source
projects/utilities/packages/discord-utilities/src/lib/InteractionOptionResolver.ts:148