@guildedts/framework
Version:
A framework for creating a Guilded bot.
42 lines • 1.59 kB
TypeScript
import { Message } from 'guilded.ts';
import { Event } from '../structures/Event';
/** The handler for commands. */
export default class CommandHandler extends Event<'messageCreate'> {
name: "messageCreate";
/**
* The handler for the messageCreate event.
* @param message The message that was created.
* @example commandHandler.execute(message);
*/
execute(message: Message): Promise<void>;
/**
* Get the command with the given name.
* @param name The name of the command.
* @returns The command.
* @example commandHandler.getCommand('ping');
*/
getCommand(name: string): import("..").Command | undefined;
/**
* Get the prefix of the message.
* @param serverId The ID of the server the message belongs to.
* @returns The prefix.
* @example commandHandler.getPrefix(serverId);
*/
getPrefix(serverId?: string): string;
/**
* Parse the content of the message.
* @param prefix The prefix of the message content.
* @param content The content of the message.
* @returns The command name and arguments.
* @example commandHandler.parseContent('!echo hello'); // ['echo', 'hello']
*/
parseContent(prefix: string, content: string): string[];
/**
* Send a error message to the user.
* @param message The message that triggered the command.
* @param error The error message.
* @example commandHandler.sendError(message, 'Invalid arguments');
*/
sendError(message: Message, error: string): void;
}
//# sourceMappingURL=commands.d.ts.map