UNPKG

@wilcosp/rex

Version:

Rex is an automated command manager for discord js

54 lines (53 loc) 2.27 kB
/*! * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import { APIApplicationCommand, RESTPostAPIChatInputApplicationCommandsJSONBody, Snowflake } from "discord-api-types/v10"; import { ApplicationCommand, AutocompleteInteraction, CacheType, ChatInputCommandInteraction } from "discord.js"; import { RexApplicationCommandBase } from "../applicationCommandBase.js"; import { RexGroupCommandInfo } from "../types/types"; import { RexSlashCommandBase } from "./commandBase.js"; export declare class RexSlashCommandGroup extends RexSlashCommandBase { protected folder: string; private _commands; private _commandinfo?; /** * create a slash command group (descript is left as "-" due to discord not displaying it) * @param name name of command group * @param description a description for in a help command * @param folder the folder in which the subcommands are located relative to where the group is created */ constructor(name: string, description: string, folder: string); get commandInfo(): RexGroupCommandInfo; /** * looads in all sub commands (only for manager) * @param dir the directory of all slash commands */ load(dir: string): Promise<void>; /** * (manager only) * @returns the complete Slash command with it's subcommands */ toCommand(): RESTPostAPIChatInputApplicationCommandsJSONBody; /** * (manager only) * @param aCom the registered command * @returns if the given command matched */ equalToCommand(aCom: ApplicationCommand | APIApplicationCommand): boolean; /** * @ignore internal only */ setCommandId(id: Snowflake): this; /** * run the subcommand within this command group * @param aCom the interaction from discord */ run(aCom: ChatInputCommandInteraction<CacheType>, commands: Map<string, RexApplicationCommandBase>): unknown; runAutoComplete(auto: AutocompleteInteraction<CacheType>, commands: Map<string, RexApplicationCommandBase>): void; /** * @ignore this isn't a feature for groups */ setExecute(): this; }