Carbon
Core/Classes

AutocompleteOptionsHandler

This class is used to parse the options of a command, and provide errors for any missing or invalid options. It is used internally by the Command class.

Extends

Constructors

Constructor

new AutocompleteOptionsHandler(client, options): AutocompleteOptionsHandler

Parameters

ParameterType
clientClient
optionsAPIApplicationCommandInteractionDataOption[]

Returns

AutocompleteOptionsHandler

Inherited from

OptionsHandler.constructor

Properties

PropertyModifierTypeDescriptionInherited from
clientpublicClient-OptionsHandler.client
rawreadonlyAPIApplicationCommandInteractionDataBasicOption[]The raw options that were in the interaction data, before they were parsed.OptionsHandler.raw

Methods

getBoolean()

Call Signature

getBoolean(key, required?): undefined | boolean

Get the value of a boolean option.

Parameters
ParameterTypeDescription
keystringThe name of the option to get the value of.
required?falseWhether the option is required.
Returns

undefined | boolean

The value of the option, or undefined if the option was not provided and it is not required.

Inherited from

OptionsHandler.getBoolean

Call Signature

getBoolean(key, required): boolean

Get the value of a boolean option.

Parameters
ParameterTypeDescription
keystringThe name of the option to get the value of.
requiredtrueWhether the option is required.
Returns

boolean

The value of the option, or undefined if the option was not provided and it is not required.

Inherited from

OptionsHandler.getBoolean


getChannel()

Call Signature

getChannel(key, required?): Promise<undefined | null | DmChannel<false> | GroupDmChannel<false> | GuildTextChannel<false> | GuildVoiceChannel<false> | GuildCategoryChannel<false> | GuildAnnouncementChannel<false> | GuildThreadChannel<ThreadChannelType, false> | GuildStageChannel<false> | GuildForumChannel<false> | GuildMediaChannel>

Get the value of a channel option.

Parameters
ParameterTypeDescription
keystringThe name of the option to get the value of.
required?falseWhether the option is required.
Returns

Promise<undefined | null | DmChannel<false> | GroupDmChannel<false> | GuildTextChannel<false> | GuildVoiceChannel<false> | GuildCategoryChannel<false> | GuildAnnouncementChannel<false> | GuildThreadChannel<ThreadChannelType, false> | GuildStageChannel<false> | GuildForumChannel<false> | GuildMediaChannel>

The value of the option, or undefined if the option was not provided and it is not required.

Inherited from

OptionsHandler.getChannel

Call Signature

getChannel(key, required): Promise<null | DmChannel<false> | GroupDmChannel<false> | GuildTextChannel<false> | GuildVoiceChannel<false> | GuildCategoryChannel<false> | GuildAnnouncementChannel<false> | GuildThreadChannel<ThreadChannelType, false> | GuildStageChannel<false> | GuildForumChannel<false> | GuildMediaChannel>

Get the value of a channel option.

Parameters
ParameterTypeDescription
keystringThe name of the option to get the value of.
requiredtrueWhether the option is required.
Returns

Promise<null | DmChannel<false> | GroupDmChannel<false> | GuildTextChannel<false> | GuildVoiceChannel<false> | GuildCategoryChannel<false> | GuildAnnouncementChannel<false> | GuildThreadChannel<ThreadChannelType, false> | GuildStageChannel<false> | GuildForumChannel<false> | GuildMediaChannel>

The value of the option, or undefined if the option was not provided and it is not required.

Inherited from

OptionsHandler.getChannel


getFocused()

getFocused(): null | { name: string; type: String | Integer | Boolean | User | Channel | Role | Mentionable | Number | Attachment; value: undefined | null | string | number | boolean; }

Get the focused option (the one that is being autocompleted)

Returns

null | { name: string; type: String | Integer | Boolean | User | Channel | Role | Mentionable | Number | Attachment; value: undefined | null | string | number | boolean; }


getInteger()

Call Signature

getInteger(key, required?): undefined | number

Get the value of an integer option.

Parameters
ParameterTypeDescription
keystringThe name of the option to get the value of.
required?falseWhether the option is required.
Returns

undefined | number

The value of the option, or undefined if the option was not provided and it is not required.

Inherited from

OptionsHandler.getInteger

Call Signature

getInteger(key, required): number

Get the value of an integer option.

Parameters
ParameterTypeDescription
keystringThe name of the option to get the value of.
requiredtrueWhether the option is required.
Returns

number

The value of the option, or undefined if the option was not provided and it is not required.

Inherited from

OptionsHandler.getInteger


getMentionable()

Call Signature

getMentionable(key, required?): Promise<undefined | User<false> | Role<true>>

Get the value of a mentionable option.

Parameters
ParameterTypeDescription
keystringThe name of the option to get the value of.
required?falseWhether the option is required.
Returns

Promise<undefined | User<false> | Role<true>>

The value of the option, or undefined if the option was not provided and it is not required.

Inherited from

OptionsHandler.getMentionable

Call Signature

getMentionable(key, required): Promise<User<false> | Role<true>>

Get the value of a mentionable option.

Parameters
ParameterTypeDescription
keystringThe name of the option to get the value of.
requiredtrueWhether the option is required.
Returns

Promise<User<false> | Role<true>>

The value of the option, or undefined if the option was not provided and it is not required.

Inherited from

OptionsHandler.getMentionable


getNumber()

Call Signature

getNumber(key, required?): undefined | number

Get the value of a number option.

Parameters
ParameterTypeDescription
keystringThe name of the option to get the value of.
required?falseWhether the option is required.
Returns

undefined | number

The value of the option, or undefined if the option was not provided and it is not required.

Inherited from

OptionsHandler.getNumber

Call Signature

getNumber(key, required): number

Get the value of a number option.

Parameters
ParameterTypeDescription
keystringThe name of the option to get the value of.
requiredtrueWhether the option is required.
Returns

number

The value of the option, or undefined if the option was not provided and it is not required.

Inherited from

OptionsHandler.getNumber


getRole()

Call Signature

getRole(key, required?): undefined | Role<true>

Get the value of a role option.

Parameters
ParameterTypeDescription
keystringThe name of the option to get the value of.
required?falseWhether the option is required.
Returns

undefined | Role<true>

The value of the option, or undefined if the option was not provided and it is not required.

Inherited from

OptionsHandler.getRole

Call Signature

getRole(key, required): Role<true>

Get the value of a role option.

Parameters
ParameterTypeDescription
keystringThe name of the option to get the value of.
requiredtrueWhether the option is required.
Returns

Role<true>

The value of the option, or undefined if the option was not provided and it is not required.

Inherited from

OptionsHandler.getRole


getString()

Call Signature

getString(key, required?): undefined | string

Get the value of a string option.

Parameters
ParameterTypeDescription
keystringThe name of the option to get the value of.
required?falseWhether the option is required.
Returns

undefined | string

The value of the option, or undefined if the option was not provided and it is not required.

Inherited from

OptionsHandler.getString

Call Signature

getString(key, required): string

Get the value of a string option.

Parameters
ParameterTypeDescription
keystringThe name of the option to get the value of.
requiredtrueWhether the option is required.
Returns

string

The value of the option, or undefined if the option was not provided and it is not required.

Inherited from

OptionsHandler.getString


getUser()

Call Signature

getUser(key, required?): undefined | User<true>

Get the value of a user option.

Parameters
ParameterTypeDescription
keystringThe name of the option to get the value of.
required?falseWhether the option is required.
Returns

undefined | User<true>

The value of the option, or undefined if the option was not provided and it is not required.

Inherited from

OptionsHandler.getUser

Call Signature

getUser(key, required): User<true>

Get the value of a user option.

Parameters
ParameterTypeDescription
keystringThe name of the option to get the value of.
requiredtrueWhether the option is required.
Returns

User<true>

The value of the option, or undefined if the option was not provided and it is not required.

Inherited from

OptionsHandler.getUser

On this page