discord-bot-cli
Version:
An easy way to build a command-based discord bot with discord.js.
115 lines (114 loc) • 4.89 kB
TypeScript
import { Message } from "discord.js";
import { Command } from "./Command";
import { CommandResult } from "./CommandResult";
import { CommandSetOptions } from "./CommandSetOptions";
import { DeepPartial } from "../utils/DeepPartial";
import { ReadonlyCommandCollection } from "./CommandCollection";
import { HelpHandler } from "./callbacks/HelpHandler";
declare type BuildInCommand = "help" | "list" | "cmd";
export declare class CommandSet {
private _defaultOptions?;
private _commands;
/** If defined, called when [[Command.help]] is called and if the command didn't define its own help handler. */
helpHandler: HelpHandler | undefined;
constructor(_defaultOptions?: {
prefix?: string | undefined;
devIDs?: readonly (string | undefined)[] | undefined;
localization?: {
typeNames?: {
string?: string | undefined;
boolean?: string | undefined;
user?: string | undefined;
integer?: string | undefined;
role?: string | undefined;
channel?: string | undefined;
float?: string | undefined;
"guild channel"?: string | undefined;
"dm channel"?: string | undefined;
"text channel"?: string | undefined;
"voice channel"?: string | undefined;
"category channel"?: string | undefined;
"news channel"?: string | undefined;
"store channel"?: string | undefined;
} | undefined;
help?: {
tags?: {
guildOnly?: string | undefined;
devOnly?: string | undefined;
} | undefined;
usage?: string | undefined;
arguments?: string | undefined;
flags?: string | undefined;
subCommands?: string | undefined;
aliases?: string | undefined;
examples?: string | undefined;
bot_permissions?: string | undefined;
user_permissions?: string | undefined;
default?: string | undefined;
commandNotFound?: string | undefined;
restTypeName?: string | undefined;
argUsageHint?: string | undefined;
} | undefined;
list?: {
title?: string | undefined;
} | undefined;
commands?: {
[x: string]: {
description?: string | undefined;
rest?: {
name?: string | undefined;
description?: string | undefined;
} | undefined;
args?: {
[x: string]: {
name?: string | undefined;
description?: string | undefined;
} | undefined;
} | undefined;
flags?: {
[x: string]: {
name?: string | undefined;
description?: string | undefined;
} | undefined;
} | undefined;
subs?: any | undefined;
} | undefined;
} | undefined;
misc?: {
guildOnlyWarning?: string | undefined;
} | undefined;
} | undefined;
allowMentionAsPrefix?: boolean | undefined;
skipDevsPermissionsChecking?: boolean | undefined;
} | undefined);
/** A readonly collection of commands. */
get commands(): ReadonlyCommandCollection;
private _loadFile;
/**
* Loads commands from the given folder path.
* Command files must have the extension `.cmd.js`.
* @param commandDirPath - The path to the folder where the commands are (relative to node entry point).
* @param includeTS - If set to `true`, files with `.cmd.ts` extension are also loaded. Usefull if you use `ts-node` (default is `false`)
*/
loadCommands(commandDirPath: string, includeTS?: boolean): void;
/** Loads all build-in commands */
buildin(buildinCommandNames: "all"): void;
/**
* Loads build-in commands.
* @param buildinCommandNames A list of build-in commands.
*/
buildin(...buildinCommandNames: BuildInCommand[]): void;
/**
* Reloads a command.
* @param command - The command to reload.
*/
reload(command: Command): void;
/**
* Parses the message's content and executes the command.
* @param message - The message to parse.
* @param options - Options to define the parsing behaviour.
* @returns The result of the parsing.
*/
parse(message: Message, options?: DeepPartial<CommandSetOptions>): Promise<CommandResult>;
}
export {};