discord-bot-cli
Version:
An easy way to build a command-based discord bot with discord.js.
34 lines (33 loc) • 1.28 kB
TypeScript
import { Command } from "./Command";
export declare class ReadonlyCommandCollection implements Iterable<Command> {
protected _commands: Map<string, Command>;
protected _alias: Map<string, Command[]>;
[Symbol.iterator](): Iterator<Command>;
/**
* Returns a command by its name of its alias, or `undefined` if not found.
* @param name The command's name or alias.
* @returns The command or `undefined`.
*/
get(name: string): Command | undefined;
/** Returns an iterable of commands in the collection. */
values(): IterableIterator<Command>;
/**
* Determines if this collection contains the alias.
* @param alias Alias to check.
* @returns Either or not this collection contains the alias.
*/
hasAlias(alias: string): boolean;
}
export declare class CommandCollection extends ReadonlyCommandCollection {
/**
* Adds a command to the collection and returns `true` if successfully added, `false` otherwise.
* @param command - The command to add.
* @returns Either or not the command has been added.
*/
add(command: Command): boolean;
/**
* Remove a command from this collection.
* @param command The command to remove.
*/
delete(command: Command): void;
}