UNPKG

nhandler

Version:

The easy to use, all-in-one command, event and component handler.

26 lines (25 loc) 1.34 kB
import { AutocompleteInteraction, ChatInputCommandInteraction } from "discord.js"; import { ExecutionError } from "../errors/ExecutionError"; import { Command } from "../interfaces/Command"; import { BaseHandler } from "./BaseHandler"; export declare class CommandHandler extends BaseHandler { commands: Command[]; protected commandExists(name: string): boolean; register(...commands: Command[]): CommandHandler; /** * 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): CommandHandler; checkConditionals(event: ChatInputCommandInteraction, command: Command): ExecutionError | undefined; runCommand(event: ChatInputCommandInteraction, metadata?: any): void; runAutocomplete(event: AutocompleteInteraction, metadata?: any): void; private callErrorIfPresent; private static isOptionInstanceOfSubcommand; private static isInstanceOfCommand; private static commandMapper; private static optionsMapper; }