nhandler
Version:
The easy to use, all-in-one command, event and component handler.
26 lines (25 loc) • 1.42 kB
TypeScript
import { Message } from "discord.js";
import { ExecutionError } from "../errors/ExecutionError";
import { LegacyCommand, LegacyCommandArgument } from "../interfaces/LegacyCommand";
import { BaseHandler } from "./BaseHandler";
export declare class LegacyCommandHandler extends BaseHandler {
legacyCommands: LegacyCommand[];
prefixes: string[];
constructor(prefixes: string[], debug?: (...args: any[]) => void);
protected commandExists(name: string): boolean;
register(...commands: LegacyCommand[]): LegacyCommandHandler;
/**
* registerFromDir automatically loads files & creates class instances in the directory specified.
* If recurse is true, it will also load commands from subdirectories.
* Auto-load commands need to have a __default__ export. Otherwise they will be ignored.
* @param dir The directory to load files from.
* @param recurse Whether to load files from subdirectories.
* */
registerFromDir(dir: string, recurse?: boolean): LegacyCommandHandler;
protected checkConditionals(message: Message, legacyCommand: LegacyCommand): ExecutionError | undefined;
protected validateArgs(args: string[], rules: LegacyCommandArgument[]): ExecutionError | undefined;
setPrefixes(prefixes: string[]): void;
runLegacyCommand(event: Message, metadata?: any): void;
private static isInstanceOfLegacyCommand;
private callErrorIfPresent;
}