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']>, { type: Type extends ChannelType.PublicThread | ChannelType.AnnouncementThread ? ChannelType.PublicThread | ChannelType.AnnouncementThread : Type; }>
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 Type[] | Yes | The allowed types of channels. If empty, all channel types are allowed. |
Gets the focused option.
Returns
The whole object of the option that is focusedGets 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. |
Gets a user 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. |