import { CommandData } from "@discord-interactions/builders"; import type { APIApplicationCommand, RESTPostAPIApplicationCommandsJSONBody, Snowflake } from "discord-api-types/v10"; import { ApplicationCommandType } from "discord-api-types/v10"; import { DiscordApplication, SyncMode } from "../DiscordApplication.js"; import { ICommand, RegisteredCommand, RegisteredCommandGroup, RegisteredMessageCommand, RegisteredSlashCommand, RegisteredUserCommand } from "../index.js"; export interface APIApplicationSlashCommand extends APIApplicationCommand { type: ApplicationCommandType.ChatInput; } export interface APIApplicationUserCommand extends APIApplicationCommand { type: ApplicationCommandType.User; } export interface APIApplicationMessageCommand extends APIApplicationCommand { type: ApplicationCommandType.Message; } export interface ParsedCommands { [ApplicationCommandType.ChatInput]: Map; [ApplicationCommandType.Message]: Map; [ApplicationCommandType.User]: Map; } export declare type MappedCommandTypes = { [ApplicationCommandType.ChatInput]: RegisteredSlashCommand | RegisteredCommandGroup; [ApplicationCommandType.Message]: RegisteredMessageCommand; [ApplicationCommandType.User]: RegisteredUserCommand; }; /** * Manager for your application's commands. Lets you register fully handled commands as well as exposes methods for managing your commands on the API side. */ export declare class CommandManager { [ApplicationCommandType.ChatInput]: Map; [ApplicationCommandType.User]: Map; [ApplicationCommandType.Message]: Map; app: DiscordApplication; syncMode: SyncMode; guildId?: Snowflake; constructor(app: DiscordApplication, guildId?: Snowflake, syncMode?: SyncMode); postCommand(data: CommandData): Promise; patchCommand(id: Snowflake, data: CommandData): Promise; deleteCommand(id: Snowflake): Promise; private parse; /** * Check whether a command is registered * @param name Command name * @param type Command type */ has(name: string, type?: ApplicationCommandType): boolean; /** * Fetch a registered command * @param name Command name * @param type Command type */ get(name: string, type?: ApplicationCommandType): RegisteredCommand | undefined; set(name: string, type: ApplicationCommandType | undefined, command: RegisteredCommand): void; /** * Rename a registered command * @param oldName Old name * @param newName New Name * @param type Command type */ rename(oldName: string, newName: string, type: ApplicationCommandType): void; /** * Register a new command to be handled. This will create the command on Discord if it doesn't exist, or overwrite it if the existing remote version differs. */ register(...commands: ICommand[]): Promise; /** * Unregister a command from this client * @param name Command name * @param type Command type * @param deleteCommand Whether to also delete this command from Discord (default: false) */ unregister(name: string, type?: ApplicationCommandType, deleteCommand?: boolean): Promise; sync(syncMode?: SyncMode): Promise; /** Deletes remote commands that aren't registered with this command manager */ deleteUnregistered(): Promise; /** * Get an array of API command objects for all registered commands */ toAPICommands(): RESTPostAPIApplicationCommandsJSONBody[]; }