A resolver for command interaction options.
Gets an option by its name.
Returns
The option, if found.Name | Type | Optional | Description |
---|---|---|---|
name | string | No | The name of the option. |
required | true | No | Whether to throw an error if the option is not found. |
Gets an attachment option.
Returns
The value of the option, or null if not set and not required.Name | Type | Optional | Description |
---|---|---|---|
name | string | No | The name of the option. |
required | true | No | Whether to throw an error if the option is not found. |
Gets a boolean option.
Returns
The value of the option, or null if not set and not required.Name | Type | Optional | Description |
---|---|---|---|
name | string | No | The name of the option. |
required | true | No | Whether to throw an error if the option is not found. |
getChannel(name, required, channelTypes?):Extract< NonNullable<CommandInteractionOption<Cached>['channel']>, { // The `type` property of the PublicThreadChannel class is typed as `ChannelType.PublicThread | ChannelType.AnnouncementThread` // If the user only passed one of those channel types, the Extract<> would have resolved to `never` // Hence the need for this ternary type: T extends ChannelType.PublicThread | ChannelType.AnnouncementThread ? ChannelType.PublicThread | ChannelType.AnnouncementThread : T; } >
Gets a channel option.
Returns
The value of the option, or null if not set and not required.Name | Type | Optional | Description |
---|---|---|---|
name | string | No | The name of the option. |
required | true | No | Whether to throw an error if the option is not found. |
channelTypes | readonly T[] | Yes | The allowed types of channels. If empty, all channel types are allowed. |
Gets the focused option.
Returns
The value of the option, or the whole option if getFull is trueName | Type | Optional | Description |
---|---|---|---|
getFull | true | No | Whether to get the full option object |
Gets an integer option.
Returns
The value of the option, or null if not set and not required.Name | Type | Optional | Description |
---|---|---|---|
name | string | No | The name of the option. |
required | true | No | Whether to throw an error if the option is not found. |
Gets a member option.
Returns
The value of the option, or null if the user is not present in the guild or the option is not set.Name | Type | Optional | Description |
---|---|---|---|
name | string | No | The name of the option. |
getMentionable(name, required):NonNullable<CommandInteractionOption<Cached>['member' | 'role' | 'user']>
Gets a mentionable option.
Returns
The value of the option, or null if not set and not required.Name | Type | Optional | Description |
---|---|---|---|
name | string | No | The name of the option. |
required | true | No | Whether to throw an error if the option is not found. |
Gets a message option.
Returns
The value of the option, or null if not set and not required.Name | Type | Optional | Description |
---|---|---|---|
name | string | No | The name of the option. |
required | true | No | Whether to throw an error if the option is not found. |
Gets a number option.
Returns
The value of the option, or null if not set and not required.Name | Type | Optional | Description |
---|---|---|---|
name | string | No | The name of the option. |
required | true | No | Whether to throw an error if the option is not found. |
Gets a role option.
Returns
The value of the option, or null if not set and not required.Name | Type | Optional | Description |
---|---|---|---|
name | string | No | The name of the option. |
required | true | No | Whether to throw an error if the option is not found. |
Gets a string option.
Returns
The value of the option, or null if not set and not required.Name | Type | Optional | Description |
---|---|---|---|
name | string | No | The name of the option. |
required | true | No | Whether to throw an error if the option is not found. |
Gets the selected subcommand.
Returns
The name of the selected subcommand, or null if not set and not required.Name | Type | Optional | Description |
---|---|---|---|
required | true | Yes | Whether to throw an error if there is no subcommand. |
Gets the selected subcommand group.
Returns
The name of the selected subcommand group, or null if not set and not required.Name | Type | Optional | Description |
---|---|---|---|
required | true | No | Whether to throw an error if there is no subcommand group. |