UNPKG

commandbot

Version:

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

89 lines (88 loc) 2.71 kB
import { BaseCommands, BaseCommandType, ChildCommands, ChildCommandType, Commands, CommandType } from "../commandsTypes.js"; import { CommandManager } from "../../structures/CommandManager.js"; import { APICommandObject } from "../../structures/apiTypes.js"; /** * Initialization options of core {@link Command} object * @interface */ export interface APICommandInit { /** * Command name * @type {string} */ name: string; /** * Discord API default permission * @type {?boolean} */ default_permission?: boolean; } /** * Bot core command object * @class */ export declare class Command { /** * Manager in which this command is registered * @type {CommandManager} * @public * @readonly */ readonly manager: CommandManager; /** * Command name * @type {string} * @public * @readonly */ readonly name: string; /** * CommandBot's internal command type * @type {CommandType} * @public * @readonly */ readonly type: CommandType; /** * Discord API default_permission * @type {boolean} * @public * @readonly */ readonly default_permission: boolean; /** * Command core constructor * @constructor * @param {CommandManager} manager - manager bound to this command * @param {CommandType} type - command internal type * @param {APICommandInit} options - initialization options */ constructor(manager: CommandManager, type: CommandType, options: APICommandInit); /** * Converts a command instance to an {@link APICommandObject} * @returns {APICommandObject} An object that is accepted by the Discord API * @public */ toObject(): APICommandObject; /** * Check base command type * @param {BaseCommandType} type - base command type * @returns {boolean} Whether this command can be used as the given type * @public */ isBaseCommandType<T extends BaseCommandType>(type: T): this is BaseCommands<T>; /** * Checks command type * @param {CommandType} type - command type * @returns {boolean} Whether this command can be used as the given type * @public */ isCommandType<T extends CommandType>(type: T): this is Commands<T>; /** * Check child command type * @param {ChildCommandType} type - child command type * @returns {boolean} Whether this command can be used as a child command of the given type * @public */ isChildCommandType<T extends ChildCommandType>(type: T): this is ChildCommands<T>; }