Skip to content

Autocomplete

Implementation of the Discord Autocomplete Interaction class in Luau

https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure

Autocomplete.state  :: State
Autocomplete.type  :: string

The type of interaction. This can be one of the following values:

  • “PING”
  • “APPLICATION_COMMAND”
  • “MESSAGE_COMPONENT”
  • “APPLICATION_COMMAND_AUTOCOMPLETE”
  • “MODAL_SUBMIT”

Inherited from Classes.Interactions.InteractionBehaviour

Autocomplete.context  :: string

The context type of the interaction. This can be one of the following values:

  • “GUILD”
  • “BOT_DM”
  • “PRIVATE_CHANNEL”

Inherited from Classes.Interactions.InteractionBehaviour

Autocomplete.id  :: string

The unique identifier for the interaction.

Inherited from Classes.Interactions.InteractionBehaviour

Autocomplete.applicationId  :: string

The ID of the application this interaction is for.

Inherited from Classes.Interactions.InteractionBehaviour

Autocomplete.data  :: InteractionBehaviourData?

The data associated with the interaction. The structure of this data varies based on the interaction type.

Inherited from Classes.Interactions.InteractionBehaviour

Autocomplete.guild  :: UnavailableGuild?

The guild where the interaction was triggered. This is only present for guild interactions.

Inherited from Classes.Interactions.InteractionBehaviour

Autocomplete.guildId  :: string?

The ID of the guild where the interaction was triggered. This is only present for guild interactions.

Inherited from Classes.Interactions.InteractionBehaviour

Autocomplete.channelId  :: string?

The ID of the channel where the interaction was triggered.

Inherited from Classes.Interactions.InteractionBehaviour

Autocomplete.member  :: Member?

The member who triggered the interaction. This is only present for guild interactions.

Inherited from Classes.Interactions.InteractionBehaviour

Autocomplete.user  :: User?

The user who triggered the interaction.

Inherited from Classes.Interactions.InteractionBehaviour

Autocomplete.token  :: string

The token used for responding to the interaction.

Inherited from Classes.Interactions.InteractionBehaviour

Autocomplete.version  :: number

The version of the interaction.

Inherited from Classes.Interactions.InteractionBehaviour

Autocomplete.message  :: Message?

The message that triggered the interaction. This is only present for message component interactions.

Inherited from Classes.Interactions.InteractionBehaviour

Autocomplete.appPermissions  :: Permission

The permissions the application has in the channel where the interaction was triggered.

Inherited from Classes.Interactions.InteractionBehaviour

Autocomplete.locale  :: string?

The selected language of the user who triggered the interaction.

Inherited from Classes.Interactions.InteractionBehaviour

Autocomplete.guildLocale  :: string?

The guild’s preferred locale, if the interaction was triggered in a guild.

Inherited from Classes.Interactions.InteractionBehaviour

Autocomplete.entitlements  :: Entitlement}

The entitlements for the user who triggered the interaction.

Inherited from Classes.Interactions.InteractionBehaviour

Autocomplete.authorizingIntegrationOwners  :: {
{[string]: string} }

The mapping of integration types to their respective owners.

Inherited from Classes.Interactions.InteractionBehaviour

Autocomplete.attachmentSizeLimit  :: number?

The maximum attachment size in bytes for this interaction, varies by guild boost tier and the invoking user’s Nitro status.

Inherited from Classes.Interactions.InteractionBehaviour

Autocomplete : respondAsync ( choices )  -> FutureLike<string, nil>

Respond to an autocomplete interaction with a list of choices. Sends interaction response type 8 (APPLICATION_COMMAND_AUTOCOMPLETE_RESULT).

interaction:respondAsync({
builders.choice.new({ name = "Option A", value = "a" }):build(),
builders.choice.new({ name = "Option B", value = "b" }):build(),
}):await()

Parameters

choices: choiceJSON }
Autocomplete : sync ( interactionData )  -> ()

Responsible for syncing data to this interaction object. This is typically called by the API when this object is created or updated.

Parameters

interactionData: InteractionObject
Autocomplete . new ( state interactionData )  -> Autocomplete

Responsible for constructing this class.

Parameters

state: State
interactionData: InteractionObject

Returns

Autocomplete
Autocomplete . inheritProperties ( class interactionData )  -> ()

Responsible for inheriting properties from the interaction data to the class instance. This function initializes all the properties of an Interaction instance based on the provided interaction data.

Parameters

class: any
interactionData: InteractionObject

Inherited from Classes.Interactions.InteractionBehaviour

Autocomplete . inheritMethods ( class )  -> ()

Responsible for inheriting methods from the Interaction prototype to the class instance. This function copies all methods from the Interaction.Prototype to the provided class instance.

Parameters

class: any

Inherited from Classes.Interactions.InteractionBehaviour