CommandInteractionOptionResolver
classe · Source
A resolver for command interaction options.
Properties
client
The client that instantiated this. Source
_group
The name of the subcommand group. Source
_subcommand
The name of the subcommand. Source
_hoistedOptions
The bottom-level options for the interaction. If there is a subcommand (or subcommand and group), this is the options for the subcommand. Source
data
The interaction options array. Source
resolved
The interaction resolved data Source
Methods
get
Gets an option by its name. Parameters
| Name | Type | Description |
|---|---|---|
name | string | The name of the option. |
required? | boolean | Whether to throw an error if the option is not found. Default: false. |
Returns: CommandInteractionOption — The option, if found. Source
_getTypedOption
Gets an option by name and property and checks its type. Parameters
| Name | Type | Description |
|---|---|---|
name | string | The name of the option. |
type | ApplicationCommandOptionType | The type of the option. |
properties | Array<string> | The properties to check for for required. |
required | boolean | Whether to throw an error if the option is not found. |
Returns: CommandInteractionOption — The option, if found. Source
getSubcommand
Gets the selected subcommand. Parameters
| Name | Type | Description |
|---|---|---|
required? | boolean | Whether to throw an error if there is no subcommand. Default: true. |
Returns: string — The name of the selected subcommand, or null if not set and not required. Source
getSubcommandGroup
Gets the selected subcommand group. Parameters
| Name | Type | Description |
|---|---|---|
required? | boolean | Whether to throw an error if there is no subcommand group. Default: true. |
Returns: string — The name of the selected subcommand group, or null if not set and not required. Source
getBoolean
Gets a boolean option. Parameters
| Name | Type | Description |
|---|---|---|
name | string | The name of the option. |
required? | boolean | Whether to throw an error if the option is not found. Default: false. |
Returns: boolean — The value of the option, or null if not set and not required. Source
getChannel
Gets a channel option. Parameters
| Name | Type | Description |
|---|---|---|
name | string | The name of the option. |
required? | boolean | Whether to throw an error if the option is not found. Default: false. |
Returns: GuildChannel \| ThreadChannel \| APIChannel — The value of the option, or null if not set and not required. Source
getString
Gets a string option. Parameters
| Name | Type | Description |
|---|---|---|
name | string | The name of the option. |
required? | boolean | Whether to throw an error if the option is not found. Default: false. |
Returns: string — The value of the option, or null if not set and not required. Source
getInteger
Gets an integer option. Parameters
| Name | Type | Description |
|---|---|---|
name | string | The name of the option. |
required? | boolean | Whether to throw an error if the option is not found. Default: false. |
Returns: number — The value of the option, or null if not set and not required. Source
getNumber
Gets a number option. Parameters
| Name | Type | Description |
|---|---|---|
name | string | The name of the option. |
required? | boolean | Whether to throw an error if the option is not found. Default: false. |
Returns: number — The value of the option, or null if not set and not required. Source
getUser
Gets a user option. Parameters
| Name | Type | Description |
|---|---|---|
name | string | The name of the option. |
required? | boolean | Whether to throw an error if the option is not found. Default: false. |
Returns: User — The value of the option, or null if not set and not required. Source
getMember
Gets a member option. Parameters
| Name | Type | Description |
|---|---|---|
name | string | The name of the option. |
required? | boolean | Whether to throw an error if the option is not found. Default: false. |
Returns: GuildMember \| APIGuildMember — The value of the option, or null if not set and not required. Source
getRole
Gets a role option. Parameters
| Name | Type | Description |
|---|---|---|
name | string | The name of the option. |
required? | boolean | Whether to throw an error if the option is not found. Default: false. |
Returns: Role \| APIRole — The value of the option, or null if not set and not required. Source
getMentionable
Gets a mentionable option. Parameters
| Name | Type | Description |
|---|---|---|
name | string | The name of the option. |
required? | boolean | Whether to throw an error if the option is not found. Default: false. |
Returns: User \| GuildMember \| APIGuildMember \| Role \| APIRole — The value of the option, or null if not set and not required. Source
getMessage
Gets a message option. Parameters
| Name | Type | Description |
|---|---|---|
name | string | The name of the option. |
required? | boolean | Whether to throw an error if the option is not found. Default: false. |
Returns: Message \| APIMessage — The value of the option, or null if not set and not required. Source
getFocused
Gets the focused option. Parameters
| Name | Type | Description |
|---|---|---|
getFull? | boolean | Whether to get the full option object Default: false. |
Returns: string \| AutocompleteFocusedOption — The value of the option, or the whole option if getFull is true Source
getAttachment
Gets an attachment option. Parameters
| Name | Type | Description |
|---|---|---|
name | string | The name of the option. |
required? | boolean | Whether to throw an error if the option is not found. Default: false. |
Returns: MessageAttachment — The value of the option, or null if not set and not required. Source