Autocomplete
Implementation of the Discord Autocomplete Interaction class in Luau
Summary
Properties
Autocomplete.state :: StateAutocomplete.type :: stringAutocomplete.context :: stringAutocomplete.id :: stringAutocomplete.applicationId :: stringAutocomplete.data :: Classes.InteractionBehaviourData?Autocomplete.guild :: Classes.UnavailableGuild?Autocomplete.guildId :: string?Autocomplete.channelId :: string?Autocomplete.member :: Classes.Guild.Member?Autocomplete.user :: Classes.User?Autocomplete.token :: stringAutocomplete.version :: numberAutocomplete.message :: Classes.Message?Autocomplete.appPermissions :: Classes.PermissionAutocomplete.locale :: string?Autocomplete.guildLocale :: string?Autocomplete.entitlements :: {Classes.Entitlement}Autocomplete.authorizingIntegrationOwners :: {[string]: string}Autocomplete.attachmentSizeLimit :: number?Properties
Section titled “Properties”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
context
Section titled “context”The context type of the interaction. This can be one of the following values:
- “GUILD”
- “BOT_DM”
- “PRIVATE_CHANNEL”
Inherited from Classes.Interactions.InteractionBehaviour
The unique identifier for the interaction.
Inherited from Classes.Interactions.InteractionBehaviour
applicationId
Section titled “applicationId”The ID of the application this interaction is for.
Inherited from Classes.Interactions.InteractionBehaviour
The data associated with the interaction. The structure of this data varies based on the interaction type.
Inherited from Classes.Interactions.InteractionBehaviour
The guild where the interaction was triggered. This is only present for guild interactions.
Inherited from Classes.Interactions.InteractionBehaviour
guildId
Section titled “guildId”The ID of the guild where the interaction was triggered. This is only present for guild interactions.
Inherited from Classes.Interactions.InteractionBehaviour
channelId
Section titled “channelId”The ID of the channel where the interaction was triggered.
Inherited from Classes.Interactions.InteractionBehaviour
member
Section titled “member”The member who triggered the interaction. This is only present for guild interactions.
Inherited from Classes.Interactions.InteractionBehaviour
The user who triggered the interaction.
Inherited from Classes.Interactions.InteractionBehaviour
The token used for responding to the interaction.
Inherited from Classes.Interactions.InteractionBehaviour
version
Section titled “version”The version of the interaction.
Inherited from Classes.Interactions.InteractionBehaviour
message
Section titled “message”The message that triggered the interaction. This is only present for message component interactions.
Inherited from Classes.Interactions.InteractionBehaviour
appPermissions
Section titled “appPermissions”The permissions the application has in the channel where the interaction was triggered.
Inherited from Classes.Interactions.InteractionBehaviour
locale
Section titled “locale”The selected language of the user who triggered the interaction.
Inherited from Classes.Interactions.InteractionBehaviour
guildLocale
Section titled “guildLocale”The guild’s preferred locale, if the interaction was triggered in a guild.
Inherited from Classes.Interactions.InteractionBehaviour
entitlements
Section titled “entitlements”The entitlements for the user who triggered the interaction.
Inherited from Classes.Interactions.InteractionBehaviour
authorizingIntegrationOwners
Section titled “authorizingIntegrationOwners”{[string]: string} }
The mapping of integration types to their respective owners.
Inherited from Classes.Interactions.InteractionBehaviour
attachmentSizeLimit
Section titled “attachmentSizeLimit”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
Methods
Section titled “Methods”respondAsync
Section titled “respondAsync”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 } |
Returns
| FutureLike<string, nil> |
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 |
Functions
Section titled “Functions”Autocomplete . new ( state , interactionData ) -> Autocomplete
Responsible for constructing this class.
Parameters
| state: State | |
| interactionData: InteractionObject |
Returns
| Autocomplete |
inheritProperties
Section titled “inheritProperties”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
inheritMethods
Section titled “inheritMethods”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