///
import Discord from "discord.js";
import EventEmitter from "events";
import Command from "./Command";
import { HelpSettings } from "./HelpCommand";
import { Logger, LoggerOptions } from "./Logging";
import * as models from "./Models";
export interface Handler {
on(event: U, listener: HandlerEvents[U]): this;
emit(event: U, ...args: Parameters): boolean;
}
export declare class Handler extends EventEmitter {
readonly client: Discord.Client;
commands: Commands;
private commandsDir;
private opts;
private listening;
readonly v: boolean;
private db;
private paused;
private logger?;
/**
* Create a new command handler
* @param {HandlerConstructor} opts - Put all options in this object. Only the client, prefix and commands directory are requred, everthing else is optional.
*/
constructor({ client, prefix, commandsDir, verbose, admins, testServers, triggers, helpCommand, logging: loggerOptions, mongodb, blacklist, pauseCommand, ignoreBots, }: HandlerConstructor);
get isPaused(): boolean;
set pause(v: boolean);
get getOpts(): HandlerOpions;
get getCommands(): Commands;
get getLogger(): Logger | undefined;
/**
* Recursively reads a directory and loads all .js and .ts files
* (if these files don't export a command they will just be ignored)
* @param {string} dir - The directory to use
* @param {boolean} reload - Whether to clear the command list before reading (useful to reload the commands)
*/
loadCommands(dir: string, reload?: boolean): Promise;
/**
* Listen for messages
*/
private listen;
/**
* Execute a command.
* (this is the function used internally for launching the commands)
* @param {Discord.Message} message - The message that contains the command
* @param {Command} command - The command to execute. (pro tip: combine with handler.getCommand)
* @returns void
*/
executeCommand(message: Discord.Message, command: Command | undefined): Promise;
/**
* Find a command from any of its aliases
* (this is the function used internally for finding commands)
* @param {string} name - Name or names of a command
* @returns The command or undefined if no command was found
*/
getCommand(name: string | string[]): Command | undefined;
/**
* Connect to the database (for cooldowns)
* @param {string} uri - MongoDB connection string
*/
private dbConnect;
/**
* A utility function to create nice embeds.
* @param title
* @param desc
* @param color
* @param thumbnail
*/
makeEmbed(title: string, desc: string, color?: Discord.ColorResolvable, thumbnail?: string): Discord.MessageEmbed;
}
export default Handler;
export declare type Commands = Discord.Collection;
export declare type HandlerOpions = {
prefix: string;
admins: Set;
testServers: Set;
triggers: Discord.Collection;
helpCommand?: HelpSettings;
blacklist: Array;
pauseCommand?: string;
ignoreBots?: boolean;
errMsg?: {
tooFewArgs?: string;
tooManyArgs?: string;
noAdmin?: string;
cooldown?: string;
globalCooldown?: string;
blacklist?: string;
noDM?: string;
};
};
export declare type HandlerConstructor = {
readonly client: Discord.Client;
prefix: string;
commandsDir: string;
verbose?: boolean;
admins?: Array;
testServers?: Array;
triggers?: Array>;
helpCommand?: HelpSettings;
logging?: LoggerOptions;
mongodb?: string;
blacklist?: Array;
pauseCommand?: string;
ignoreBots?: boolean;
};
export declare type HandlerEvents = {
ready: () => void;
dbConnected: () => void;
dbConnectFailed: (err: unknown) => void;
dbSynced: () => void;
};
export declare type HandlerCache = Discord.Collection;
//# sourceMappingURL=Handler.d.ts.map