UNPKG

commandbot

Version:

A framework that helps you create your own Discord bot easier.

94 lines (93 loc) 2.94 kB
import { Parameter, ParameterSchema } from "../structures/Parameter.js"; import { PermissionCommand, PermissionCommandInit } from "./base/PermissionCommand.js"; import { SubCommandGroup } from "./SubCommandGroup.js"; import { ChatCommandObject } from "../structures/apiTypes.js"; import { ChatCommand } from "./ChatCommand.js"; import { InputManager } from "../structures/InputManager.js"; /** * Subcommand initialization options * @interface * @extends {PermissionCommandInit} */ export interface SubCommandInit extends PermissionCommandInit { /** * Command description * @type {?string} */ description?: string; /** * List of object defining all parameters of the command * @type {?Array<ParameterSchema> | "simple" | "no_input"} */ parameters?: ParameterSchema[] | "simple" | "no_input"; /** * Different string that can be used with prefix to invoke the command * @type {?Array<string>} */ aliases?: string[] | string; /** * Command usage (if *undefined*, the usage will be automatically generated using parameters) * @type {?string} */ usage?: string; } /** * Representation of SUB_COMMAND Discord interaction * @class */ export declare class SubCommand extends PermissionCommand { /** * Command parent * @type {SubCommand | ChatCommand} * @public * @readonly */ readonly parent: SubCommandGroup | ChatCommand; /** * Command description displayed in the help message or in slash commands menu (Default description: "No description") * @type {string} * @public * @readonly */ readonly description: string; /** * List of parameters that can passed to this command * @type {Array<Parameter>} * @public * @readonly */ readonly parameters: Parameter<any>[]; /** * List of different names that can be used to invoke a command (when using prefix interactions) * @type {?Array<string>} * @public * @readonly */ readonly aliases?: string[]; /** * Command usage displayed in the help message * @type {?string} * @public * @readonly */ readonly usage?: string; /** * Subcommand constructor (SUB_COMMAND parameter in Discord API) * @constructor * @param {SubCommandGroup | ChatCommand} parent - command parent * @param {SubCommandInit} options - initialization options */ constructor(parent: SubCommandGroup | ChatCommand, options: SubCommandInit); /** * Invoke the command * @param {InputManager} input - input data * @returns {Promise<void>} * @async */ start(input: InputManager): Promise<void>; /** * @returns {ChatCommandObject} Discord API object * @public */ toObject(): ChatCommandObject; }