UNPKG

advanced-command-handler

Version:

A package to help you create a bot with only 1 main file, directories for your events/commands, with some helpers classes and functions.

51 lines (50 loc) 1.44 kB
import { CommandHandlerError } from './CommandHandlerError'; export declare enum CommandErrorType { ARGUMENT_NOT_FOUND = 0, CLIENT_MISSING_PERMISSIONS = 1, COOLDOWN = 2, ERROR = 3, INVALID_ARGUMENT = 4, MISSING_TAGS = 5, USER_MISSING_PERMISSIONS = 6, WRONG_CHANNEL = 7 } /** * The object to create a new CommandError. */ export interface CommandErrorBuilder { /** * The data of the error, can be anything but should be related to the error type. * * @see CommandErrorBuilder#type. */ data?: any; /** * The message of the error, to inform what is the problem. */ message: string; /** * The type of error. */ type: CommandErrorType; } export declare class CommandError extends CommandHandlerError { /** * The data of the error, can be anything but should be related to the error type. * * @see CommandErrorBuilder#type. */ readonly data: any; /** * The type of CommandError. */ readonly type: CommandErrorType; /** * Creates a new CommandError. * * @see {@link CommandErrorType} to see what those errors are related to. * @see {@link Command#validate} to see when those errors can occur. * @param options - The options of the error, containing type and raw data. */ constructor(options: CommandErrorBuilder); }