AutocompleteInteraction
AutocompleteInteraction ⇐ Interaction
Represents an interaction with an autocomplete component.
Kind: global class
Extends: Interaction
- AutocompleteInteraction ⇐
Interaction
- new AutocompleteInteraction([data], guildId, client)
- instance
- .getFocused() ⇒
- .respond(choices) ⇒
Promise
- static
- .transformChoices(choices) ⇒
Object
- .transformChoices(choices) ⇒
new AutocompleteInteraction([data], guildId, client)
Constructs a new instance of the class.
Param | Type | Description |
---|---|---|
[data] | Object | The data object to initialize the instance with. |
guildId | string | The ID of the guild associated with the instance. |
client | Client | The client instance associated with the instance. |
autocompleteInteraction.getFocused() ⇒
Retrieves the focused option from the data object.
Kind: instance method of AutocompleteInteraction
Returns: The value of the focused option, or null if no option is focused or if the value is not available.
autocompleteInteraction.respond(choices) ⇒ Promise
Sends a response to an autocomplete interaction with the provided choices.
Kind: instance method of AutocompleteInteraction
Returns: Promise
- A promise that resolves when the response is sent.
Param | Type | Description |
---|---|---|
choices | Array | An array of choices for the autocomplete interaction. |
AutocompleteInteraction.transformChoices(choices) ⇒ Object
Transforms the given choices object into a new object with the name and value properties.
Kind: static method of AutocompleteInteraction
Returns: Object
- - The transformed choices object with name and value properties.
Throws:
RangeError
- If the length of the name property is less than 1 or greater than 100.
Param | Type | Description |
---|---|---|
choices | Object | The choices object to transform. |