UNPKG

commandbot

Version:

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

133 lines (132 loc) 3.44 kB
import { GuildMember } from "discord.js"; import { Command } from "./commands/base/Command.js"; import { Parameter } from "./structures/Parameter.js"; import { ParameterResolvable, ParameterType } from "./structures/Parameter.js"; /** * Error indicating that a caller doesn't have enough permissions to execute a command * @class * @extends {Error} */ export declare class PermissionsError extends Error { /** * Command that user wanted and failed to invoke * @type {Command} * @private * @readonly */ private readonly command; /** * User that doesn't have the permissions * @type {?GuildMember} * @private * @readonly */ private readonly user; /** * @constructor * @param {Command} command - command that user wanted and failed to invoke * @param {?GuildMember} [user] - user that doesn't have the permissions */ constructor(command: Command, user?: GuildMember | null); /** * Converts error object to user-readable message * @returns {string} Formatted error message * @public */ toString(): string; } /** * Error indicating that an input value cannot be converted to a expected type * @class * @extends {TypeError} */ export declare class ParameterTypeError extends TypeError { /** * Value converted to a string * @type {string} * @private * @readonly */ private readonly stringContent; /** * Expected type * @type {ParameterType} * @private * @readonly */ private readonly type; /** * @constructor * @param {ParameterResolvable} s - value with an invalid type * @param {ParameterType} type - expected type */ constructor(s: ParameterResolvable, type: ParameterType); /** * Converts error object to user-readable message * @returns {string} Formatted error message * @public */ toString(): string; } /** * Error indicating that a required parameter is missing in the request * @class * @extends {ReferenceError} */ export declare class MissingParameterError extends ReferenceError { /** * Missing parameter object * @type {Parameter<any>} * @private * @readonly */ private readonly argument; /** * @constructor * @param {Parameter<any>} a - missing parameter object */ constructor(a: Parameter<any>); /** * Converts error object to user-readable message * @returns {string} Formatted error message * @public */ toString(): string; } /** * Object indicating command execution success * @class */ export declare class OperationSuccess { /** * Command that succeeded * @type {Command} * @public * @readonly */ readonly command: Command; /** * @constructor * @param {Command} c - command that succeeded */ constructor(c: Command); } /** * Error thrown when there is no command with the given name * @class * @extends {Error} */ export declare class CommandNotFound extends Error { /** * User query * @type {string} * @public * @readonly */ readonly query?: string; /** * @constructor * @param {?string} [q] - user query */ constructor(q?: string); }