/** @module AutocompleteInteraction */ import Interaction from "./Interaction"; import type Member from "./Member"; import type User from "./User"; import type Guild from "./Guild"; import Permission from "./Permission"; import type PrivateChannel from "./PrivateChannel"; import { type InteractionTypes } from "../Constants"; import type { AutocompleteChoice, AutocompleteInteractionData, RawAutocompleteInteraction } from "../types/interactions"; import type Client from "../Client"; import type { AnyGuildTextChannel, AnyTextChannelWithoutGroup } from "../types/channels"; import type { JSONAutocompleteInteraction } from "../types/json"; import type { Uncached } from "../types/shared"; /** Represents an autocomplete interaction. */ export default class AutocompleteInteraction extends Interaction { private _cachedChannel; private _cachedGuild?; /** The permissions the bot has in the channel this interaction was sent from, if this interaction is sent from a guild. */ appPermissions: T extends AnyGuildTextChannel ? Permission : Permission | undefined; /** The ID of the channel this interaction was sent from. */ channelID: string; /** The data associated with the interaction. */ data: AutocompleteInteractionData; /** The id of the guild this interaction was sent from, if applicable. */ guildID: T extends AnyGuildTextChannel ? string : string | null; /** The preferred [locale](https://discord.com/developers/docs/reference#locales) of the guild this interaction was sent from, if applicable. */ guildLocale: T extends AnyGuildTextChannel ? string : string | undefined; /** The [locale](https://discord.com/developers/docs/reference#locales) of the invoking user. */ locale: string; /** The member associated with the invoking user, if this interaction is sent from a guild. */ member: T extends AnyGuildTextChannel ? Member : Member | undefined; /** The permissions of the member associated with the invoking user, if this interaction is sent from a guild. */ memberPermissions: T extends AnyGuildTextChannel ? Permission : Permission | undefined; type: InteractionTypes.APPLICATION_COMMAND_AUTOCOMPLETE; /** The user that invoked this interaction. */ user: User; constructor(data: RawAutocompleteInteraction, client: Client); /** The channel this interaction was sent from. */ get channel(): T extends AnyTextChannelWithoutGroup ? T : undefined; /** The guild this interaction was sent from, if applicable. This will throw an error if the guild is not cached. */ get guild(): T extends AnyGuildTextChannel ? Guild : Guild | null; /** Whether this interaction belongs to a cached guild channel. The only difference on using this method over a simple if statement is to easily update all the interaction properties typing definitions based on the channel it belongs to. */ inCachedGuildChannel(): this is AutocompleteInteraction; /** Whether this interaction belongs to a private channel (PrivateChannel or uncached). The only difference on using this method over a simple if statement is to easily update all the interaction properties typing definitions based on the channel it belongs to. */ inPrivateChannel(): this is AutocompleteInteraction; /** * Acknowledge this interaction with a set of choices. This is an initial response, and more than one initial response cannot be used. * @param choices The choices to send. */ result(choices: Array): Promise; toJSON(): JSONAutocompleteInteraction; }