Skip to content

AutocompleteInteraction

classe · Source

Represents an autocomplete interaction.

Extends: Interaction

Properties

channelId

channelId: Snowflake

The id of the channel this interaction was sent in Source

commandId

commandId: Snowflake

The invoked application command's id Source

commandName

commandName: string

The invoked application command's name Source

responded

responded: boolean

Whether this interaction has already received a response Source

options

options: CommandInteractionOptionResolver

The options passed to the command Source

command

nullable

command: ApplicationCommand

The invoked application command, if it was fetched before Source

type

type: InteractionType

The interaction's type Source

id

id: Snowflake

The interaction's id Source

token

readonly

token: string

The interaction's token Source

applicationId

applicationId: Snowflake

The application's id Source

guildId

nullable

guildId: Snowflake

The id of the guild this interaction was sent in Source

user

user: User

The user which sent this interaction Source

member

nullable

member: GuildMember | APIGuildMember

If this interaction was sent in a guild, the member which sent it Source

version

version: number

The version Source

appPermissions

nullable

appPermissions: Readonly<Permissions>

Set of permissions the application or bot has within the channel the interaction was sent from Source

memberPermissions

nullable

memberPermissions: Readonly<Permissions>

The permissions of the member, if one exists, in the channel this interaction was executed in Source

locale

locale: Locale

The locale of the user who invoked this interaction Source

guildLocale

nullable

guildLocale: Locale

The preferred locale from the guild this interaction was sent in Source

authorizingIntegrationOwners

authorizingIntegrationOwners: AuthorizingIntegrationOwners

Owners for each installation context that authorized this interaction. Source

createdTimestamp

readonly

createdTimestamp: number

The timestamp the interaction was created at Source

createdAt

readonly

createdAt: Date

The time the interaction was created at Source

channel

readonly · nullable

channel: TextBasedChannels

The channel this interaction was sent in Source

guild

readonly · nullable

guild: Guild

The guild this interaction was sent in Source

client

readonly

client: Client

The client that instantiated this Source

Methods

transformOption

private

transformOption(option: APIApplicationCommandOption): CommandInteractionOption

Transforms an option received from the API. Parameters

NameTypeDescription
optionAPIApplicationCommandOptionThe received option

Returns: CommandInteractionOptionSource

respond

async

async respond(options: Array<ApplicationCommandOptionChoiceData>): Promise<void>

Sends results for the autocomplete of this interaction. Parameters

NameTypeDescription
optionsArray<ApplicationCommandOptionChoiceData>The options for the autocomplete

Returns: Promise<void>

js
// respond to autocomplete interaction
interaction.respond([
 {
   name: 'Option 1',
   value: 'option1',
 },
])
 .then(console.log)
 .catch(console.error);

Source

inGuild

inGuild(): boolean

Indicates whether this interaction is received from a guild. Returns: booleanSource

inCachedGuild

inCachedGuild(): boolean

Indicates whether or not this interaction is both cached and received from a guild. Returns: booleanSource

inRawGuild

inRawGuild(): boolean

Indicates whether or not this interaction is received from an uncached guild. Returns: booleanSource

isApplicationCommand

isApplicationCommand(): boolean

Indicates whether this interaction is a BaseCommandInteraction. Returns: booleanSource

isCommand

isCommand(): boolean

Indicates whether this interaction is a CommandInteraction. Returns: booleanSource

isContextMenu

isContextMenu(): boolean

Indicates whether this interaction is a ContextMenuInteractionReturns: booleanSource

isModalSubmit

isModalSubmit(): boolean

Indicates whether this interaction is a ModalSubmitInteractionReturns: booleanSource

isUserContextMenu

isUserContextMenu(): boolean

Indicates whether this interaction is a UserContextMenuInteractionReturns: booleanSource

isMessageContextMenu

isMessageContextMenu(): boolean

Indicates whether this interaction is a MessageContextMenuInteractionReturns: booleanSource

isAutocomplete

isAutocomplete(): boolean

Indicates whether this interaction is an AutocompleteInteractionReturns: booleanSource

isMessageComponent

isMessageComponent(): boolean

Indicates whether this interaction is a MessageComponentInteraction. Returns: booleanSource

isButton

isButton(): boolean

Indicates whether this interaction is a ButtonInteraction. Returns: booleanSource

isSelectMenu

isSelectMenu(): boolean

Indicates whether this interaction is a SelectMenuInteraction. Returns: booleanSource

isRepliable

isRepliable(): boolean

Indicates whether this interaction can be replied to. Returns: booleanSource

Unofficial software. Not affiliated with or supported by Discord.