UNPKG

slash-create-modify

Version:

Create and sync Discord slash commands!

65 lines (64 loc) 2.58 kB
import { AnyCommandOption, CommandAutocompleteRequestData } from '../../constants'; import { SlashCreator } from '../../creator'; import { RespondFunction } from '../../server'; import { Member } from '../member'; import { Permissions } from '../permissions'; import { User } from '../user'; /** Represents a autocomplete interaction context. */ export declare class AutocompleteContext { /** The full interaction data. */ readonly data: CommandAutocompleteRequestData; /** The creator of the interaction request. */ readonly creator: SlashCreator; /** The interaction's token. */ readonly interactionToken: string; /** The interaction's ID. */ readonly interactionID: string; /** The channel ID that the interaction was invoked in. */ readonly channelID: string; /** The guild ID that the interaction was invoked in. */ readonly guildID?: string; /** The member that invoked the interaction. */ readonly member?: Member; /** The user that invoked the interaction. */ readonly user: User; /** The options given to the command. */ readonly options: { [key: string]: any; }; /** The option name that is currently focused. */ readonly focused: string; /** The subcommands the member used in order. */ readonly subcommands: string[]; /** The time when the interaction was created. */ readonly invokedAt: number; /** The permissions the application has. */ readonly appPermissions?: Permissions; /** Whether the interaction has been responded to. */ responded: boolean; /** @hidden */ protected _respond: RespondFunction; /** * @param creator The instantiating creator. * @param data The interaction data. * @param respond The response function for the interaction. */ constructor(creator: SlashCreator, data: CommandAutocompleteRequestData, respond: RespondFunction); /** Whether the interaction has expired. Interactions last 15 minutes. */ get expired(): boolean; /** * Sends the results of an autocomplete interaction. * @param choices The choices to display */ sendResults(choices: AutocompleteChoice[]): Promise<boolean>; /** @private */ static convertOptions(options: AnyCommandOption[]): { [key: string]: any; }; /** @private */ static getFocusedOption(options: AnyCommandOption[]): string | undefined; } export interface AutocompleteChoice { name: string; value: string | number; }