CommandInteractionOptionResolver

export class CommandInteractionOptionResolver<Cached extends CacheType = CacheType>
export class CommandInteractionOptionResolver<Cached extends CacheType = CacheType>
A resolver for command interaction options.
NameConstraintsOptionalDefaultDescription
CachedCacheTypeYesCacheTypeNone
Readonly
client:Client
The client that instantiated this.
Readonly
data:readonly CommandInteractionOption<Cached>[]
The interaction options array.
Readonly
The interaction resolved data
get(name, required):CommandInteractionOption<Cached>
Gets an option by its name.
Returns
The option, if found.
NameTypeOptionalDescription
namestringNoThe name of the option.
requiredtrueNoWhether to throw an error if the option is not found.
getAttachment(name, required):NonNullable<CommandInteractionOption<Cached>['attachment']>
Gets an attachment option.
Returns
The value of the option, or null if not set and not required.
NameTypeOptionalDescription
namestringNoThe name of the option.
requiredtrueNoWhether to throw an error if the option is not found.
getBoolean(name, required):boolean
Gets a boolean option.
Returns
The value of the option, or null if not set and not required.
NameTypeOptionalDescription
namestringNoThe name of the option.
requiredtrueNoWhether 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.
NameTypeOptionalDescription
namestringNoThe name of the option.
requiredtrueNoWhether to throw an error if the option is not found.
channelTypesreadonly Type[]YesThe allowed types of channels. If empty, all channel types are allowed.
getFocused(getFull):AutocompleteFocusedOption
Gets the focused option.
Returns
The value of the option, or the whole option if getFull is true
NameTypeOptionalDescription
getFulltrueNoWhether to get the full option object
getInteger(name, required):number
Gets an integer option.
Returns
The value of the option, or null if not set and not required.
NameTypeOptionalDescription
namestringNoThe name of the option.
requiredtrueNoWhether to throw an error if the option is not found.
getMember(name):NonNullable<CommandInteractionOption<Cached>['member']> | null
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.
NameTypeOptionalDescription
namestringNoThe 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.
NameTypeOptionalDescription
namestringNoThe name of the option.
requiredtrueNoWhether to throw an error if the option is not found.
getMessage(name, required):NonNullable<CommandInteractionOption<Cached>['message']>
Gets a message option.
Returns
The value of the option, or null if not set and not required.
NameTypeOptionalDescription
namestringNoThe name of the option.
requiredtrueNoWhether to throw an error if the option is not found.
getNumber(name, required):number
Gets a number option.
Returns
The value of the option, or null if not set and not required.
NameTypeOptionalDescription
namestringNoThe name of the option.
requiredtrueNoWhether to throw an error if the option is not found.
getRole(name, required):NonNullable<CommandInteractionOption<Cached>['role']>
Gets a role option.
Returns
The value of the option, or null if not set and not required.
NameTypeOptionalDescription
namestringNoThe name of the option.
requiredtrueNoWhether to throw an error if the option is not found.
getString(name, required):string
Gets a string option.
Returns
The value of the option, or null if not set and not required.
NameTypeOptionalDescription
namestringNoThe name of the option.
requiredtrueNoWhether to throw an error if the option is not found.
getSubcommand(required?):string
Gets the selected subcommand.
Returns
The name of the selected subcommand, or null if not set and not required.
NameTypeOptionalDescription
requiredtrueYesWhether to throw an error if there is no subcommand.
getSubcommandGroup(required):string
Gets the selected subcommand group.
Returns
The name of the selected subcommand group, or null if not set and not required.
NameTypeOptionalDescription
requiredtrueNoWhether to throw an error if there is no subcommand group.
getUser(name, required):NonNullable<CommandInteractionOption<Cached>['user']>
Gets a user option.
Returns
The value of the option, or null if not set and not required.
NameTypeOptionalDescription
namestringNoThe name of the option.
requiredtrueNoWhether to throw an error if the option is not found.