import Command from '../structures/Command'; import HandlesClient from './Client'; import { IConfig } from '../interfaces/Config'; import { Message } from 'discord.js'; export declare type MessageValidator = (m: Message) => string | null | Promise; /** * Class for handling a command. */ export default class CommandHandler { /** * The client. */ readonly handles: HandlesClient; /** * Sessions to ignore. */ readonly ignore: string[]; /** * Whether the [[handle]] method should always resolve with void (use when relying on events to catch errors). */ silent: boolean; /** * The message validator from config. */ validator: MessageValidator; /** * Methods to run before each command. Executed in sequence before the command's `pre` method. * **Deprecated:** the command parameter will be removed. */ pre: Array<(this: Command, cmd: Command) => any>; /** * Methods to run after each command. Executed in sequence after the command's `post` method. * **Deprecated:** the command parameter will be removed. */ post: Array<(this: Command, cmd: Command) => any>; /** * Recently executed commands. Stored regardless of success or failure. */ executed: Command[]; constructor(handles: HandlesClient, config: IConfig); /** * Resolve a command from a message. */ resolve(message: Message): Promise; /** * Execute a command message. */ exec(cmd: Command): Promise; /** * Ignore something (designed for [[CommandMessage#session]]). * @param session The data to ignore. */ private _ignore(session); /** * Stop ignoring something (designed for [[CommandMessage#session]]). * @param session The data to unignore. */ private _unignore(session); }