Class: InteractionOptionResolver
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:7
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
Constructor
new InteractionOptionResolver(
interaction:APIApplicationCommandInteraction|APIApplicationCommandAutocompleteInteraction|APIModalSubmitInteraction):InteractionOptionResolver
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:30
Parameters
| Parameter | Type |
|---|---|
interaction | APIApplicationCommandInteraction | APIApplicationCommandAutocompleteInteraction | APIModalSubmitInteraction |
Returns
InteractionOptionResolver
Properties
data
privatereadonlydata:any
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:12
The interaction options array
getTypedOption
privategetTypedOption:any
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:136
group
privatereadonlygroup:any
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:25
The name of the subcommand group
hoistedOptions
privatereadonlyhoistedOptions:any
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:21
Bottom-level options for the interaction If there is a subcommand (or subcommand and group), this represents the options for the subcommand.
interaction
privatereadonlyinteraction:any
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:8
resolved
privatereadonlyresolved:any
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:16
The interaction resolved data
subcommand
privatereadonlysubcommand:any
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:29
The name of the subcommand
Methods
get()
get<
Required>(name:string,required?:Required):If<Required,APIApplicationCommandInteractionDataOption>
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:36
Gets an option by its name
Type Parameters
| Type Parameter | Default type |
|---|---|
Required extends boolean | false |
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The name of the option |
required? | Required | Whether to throw an error if the option is not found |
Returns
If<Required, APIApplicationCommandInteractionDataOption>
getAttachment()
getAttachment<
Required>(name:string,required?:Required):If<Required,APIAttachment>
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:100
Gets an attachment option
Type Parameters
| Type Parameter | Default type |
|---|---|
Required extends boolean | false |
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The name of the option |
required? | Required | Whether to throw an error if the option is not found |
Returns
If<Required, APIAttachment>
getBoolean()
getBoolean<
Required>(name:string,required?:Required):If<Required,boolean>
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:52
Gets a boolean option
Type Parameters
| Type Parameter | Default type |
|---|---|
Required extends boolean | false |
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The name of the option |
required? | Required | Whether to throw an error if the option is not found |
Returns
If<Required, boolean>
getChannel()
getChannel<
Required>(name:string,required?:Required):If<Required,APIInteractionDataResolvedChannel>
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:58
Gets a channel option
Type Parameters
| Type Parameter | Default type |
|---|---|
Required extends boolean | false |
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The name of the option |
required? | Required | Whether to throw an error if the option is not found |
Returns
If<Required, APIInteractionDataResolvedChannel>
getFocusedOption()
getFocusedOption(): {
name:string;type:String;value:string; } | {name:string;type:Integer;value:string|number; } | {name:string;type:Number;value:string|number; }
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:123
Gets the focused option for an autocomplete interaction
Returns
{ name: string; type: String; value: string; } | { name: string; type: Integer; value: string | number; } | { name: string; type: Number; value: string | number; }
getInteger()
getInteger<
Required>(name:string,required?:Required):If<Required,number>
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:70
Gets an integer option
Type Parameters
| Type Parameter | Default type |
|---|---|
Required extends boolean | false |
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The name of the option |
required? | Required | Whether to throw an error if the option is not found |
Returns
If<Required, number>
getMember()
getMember<
Required>(name:string,required?:Required):If<Required,APIInteractionDataResolvedGuildMember>
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:88
Gets a member option
Type Parameters
| Type Parameter | Default type |
|---|---|
Required extends boolean | false |
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The name of the option |
required? | Required | Whether to throw an error if the option is not found |
Returns
If<Required, APIInteractionDataResolvedGuildMember>
getMentionable()
getMentionable<
Required>(name:string,required?:Required):If<Required,APIRole|APIUser|APIInteractionDataResolvedGuildMember>
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:106
Gets a mentionable option
Type Parameters
| Type Parameter | Default type |
|---|---|
Required extends boolean | false |
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The name of the option |
required? | Required | Whether to throw an error if the option is not found |
Returns
If<Required, APIRole | APIUser | APIInteractionDataResolvedGuildMember>
getNumber()
getNumber<
Required>(name:string,required?:Required):If<Required,number>
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:76
Gets a number option
Type Parameters
| Type Parameter | Default type |
|---|---|
Required extends boolean | false |
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The name of the option |
required? | Required | Whether to throw an error if the option is not found |
Returns
If<Required, number>
getRole()
getRole<
Required>(name:string,required?:Required):If<Required,APIRole>
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:94
Gets a role option
Type Parameters
| Type Parameter | Default type |
|---|---|
Required extends boolean | false |
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The name of the option |
required? | Required | Whether to throw an error if the option is not found |
Returns
If<Required, APIRole>
getString()
getString<
Required>(name:string,required?:Required):If<Required,string>
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:64
Gets a string option
Type Parameters
| Type Parameter | Default type |
|---|---|
Required extends boolean | false |
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The name of the option |
required? | Required | Whether to throw an error if the option is not found |
Returns
If<Required, string>
getSubcommand()
getSubcommand<
Required>(required?:Required):If<Required,string>
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:41
Gets the selected subcommand
Type Parameters
| Type Parameter | Default type |
|---|---|
Required extends boolean | false |
Parameters
| Parameter | Type | Description |
|---|---|---|
required? | Required | Whether to throw an error if there is no subcommand |
Returns
If<Required, string>
getSubcommandGroup()
getSubcommandGroup<
Required>(required?:Required):If<Required,string>
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:46
Gets the selected subcommand group
Type Parameters
| Type Parameter | Default type |
|---|---|
Required extends boolean | false |
Parameters
| Parameter | Type | Description |
|---|---|---|
required? | Required | Whether to throw an error if there is no subcommand group |
Returns
If<Required, string>
getTargetMember()
getTargetMember<
Required>(required?:Required):If<Required,APIInteractionDataResolvedGuildMember>
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:115
Gets the target member for a context menu interaction
Type Parameters
| Type Parameter | Default type |
|---|---|
Required extends boolean | false |
Parameters
| Parameter | Type | Description |
|---|---|---|
required? | Required | Whether to throw an error if the member data is not present |
Returns
If<Required, APIInteractionDataResolvedGuildMember>
getTargetMessage()
getTargetMessage():
APIMessage
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:119
Gets the target message for a context menu interaction
Returns
APIMessage
getTargetUser()
getTargetUser():
APIUser
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:110
Gets the target user for a context menu interaction
Returns
APIUser
getUser()
getUser<
Required>(name:string,required?:Required):If<Required,APIUser>
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:82
Gets a user option
Type Parameters
| Type Parameter | Default type |
|---|---|
Required extends boolean | false |
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The name of the option |
required? | Required | Whether to throw an error if the option is not found |
Returns
If<Required, APIUser>