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
new InteractionOptionResolver()
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
Properties
data
private
readonly
data:any
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:12
The interaction options array
getTypedOption
private
getTypedOption:any
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:136
group
private
readonly
group:any
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:25
The name of the subcommand group
hoistedOptions
private
readonly
hoistedOptions: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
private
readonly
interaction:any
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:8
resolved
private
readonly
resolved:any
Defined in: node_modules/@sapphire/discord-utilities/dist/esm/index.d.mts:16
The interaction resolved data
subcommand
private
readonly
subcommand: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
,null
|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
, null
| APIApplicationCommandInteractionDataOption
>
getAttachment()
getAttachment<
Required
>(name
:string
,required
?:Required
):If
<Required
,APIAttachment
,null
|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
, null
| APIAttachment
>
getBoolean()
getBoolean<
Required
>(name
:string
,required
?:Required
):If
<Required
,boolean
,null
|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
, null
| boolean
>
getChannel()
getChannel<
Required
>(name
:string
,required
?:Required
):If
<Required
,APIInteractionDataResolvedChannel
,null
|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
, null
| APIInteractionDataResolvedChannel
>
getFocusedOption()
getFocusedOption(): {
name
:string
;type
:Integer
;value
:number
; } | {name
:string
;type
:Number
;value
:number
; } | {name
:string
;type
:String
;value
:string
; }
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
: Integer
; value
: number
; } | { name
: string
; type
: Number
; value
: number
; } | { name
: string
; type
: String
; value
: string
; }
getInteger()
getInteger<
Required
>(name
:string
,required
?:Required
):If
<Required
,number
,null
|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
, null
| number
>
getMember()
getMember<
Required
>(name
:string
,required
?:Required
):If
<Required
,APIInteractionDataResolvedGuildMember
,null
|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
, null
| APIInteractionDataResolvedGuildMember
>
getMentionable()
getMentionable<
Required
>(name
:string
,required
?:Required
):If
<Required
,APIRole
|APIUser
|APIInteractionDataResolvedGuildMember
,null
|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
, null
| APIRole
| APIUser
| APIInteractionDataResolvedGuildMember
>
getNumber()
getNumber<
Required
>(name
:string
,required
?:Required
):If
<Required
,number
,null
|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
, null
| number
>
getRole()
getRole<
Required
>(name
:string
,required
?:Required
):If
<Required
,APIRole
,null
|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
, null
| APIRole
>
getString()
getString<
Required
>(name
:string
,required
?:Required
):If
<Required
,string
,null
|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
, null
| string
>
getSubcommand()
getSubcommand<
Required
>(required
?:Required
):If
<Required
,string
,null
|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
, null
| string
>
getSubcommandGroup()
getSubcommandGroup<
Required
>(required
?:Required
):If
<Required
,string
,null
|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
, null
| string
>
getTargetMember()
getTargetMember<
Required
>(required
?:Required
):If
<Required
,APIInteractionDataResolvedGuildMember
,null
|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
, null
| 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
,null
|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
, null
| APIUser
>