@wilcosp/rex
Version:
Rex is an automated command manager for discord js
63 lines (62 loc) • 2.72 kB
TypeScript
/*!
* 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, APIApplicationCommandSubcommandGroupOption, RESTPostAPIChatInputApplicationCommandsJSONBody, Snowflake } from "discord-api-types/v10";
import { ApplicationCommand, ApplicationCommandSubGroup, AutocompleteInteraction, CacheType, ChatInputCommandInteraction } from "discord.js";
import { RexApplicationCommandBase } from "../applicationCommandBase.js";
import { RexSubCommandInfo } from "../types/types";
import { RexSlashCommandBase } from "./commandBase.js";
export declare class RexSlashCommandSub 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(): RexSubCommandInfo;
/**
* 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;
toSlashSubCommand(): APIApplicationCommandSubcommandGroupOption;
/**
* @ignore (manager only)
* @param aCom the registered command
* @returns if the given command matched
*/
equalToCommand(aCom: ApplicationCommand | APIApplicationCommand): boolean;
/**
* @ignore manager only
* @param existing the existing subgroupcommand
* @returns if the given group matched
*/
equaltoGroupSlashCommand(existing: APIApplicationCommandSubcommandGroupOption | ApplicationCommandSubGroup): boolean;
/**
* @ignore internal only
*/
setCommandId(id: Snowflake, { group }?: {
group?: string;
}): 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 subs
*/
setExecute(): this;
}