UNPKG

vnftjs

Version:

Discord CommandHandler for TypeScript or JavaScript

64 lines (63 loc) 2.08 kB
import { Client, Message, ColorResolvable } from "discord.js"; import { Command } from "./Command"; import { Script } from "./Script"; /** * @extends {Client} */ export declare class CommandHandler extends Client { commands: Command[]; scripts: Script[]; scriptsTriggered: boolean; prefix: string; helpColor: ColorResolvable; debug: boolean; /** * The constructor of the CommandHandler class. * @constructor */ constructor(); /** * Gets executed at each message. * Checks an Message for a Command and executes it if one has been found. * @param {Message} message - The Discord Message that should be checked for a Command. */ commandListener(message: Message): boolean; /** * Adds a Command to the List of known Commands * @param {Command} command - The Command that should be added. */ addCommand(command: Command): void; /** * Adds a Script to the List of known Scripts. Instantly triggers it if the Discord Client has already logged in. * @param {Script} script - The Script that should be added. */ addScript(script: Script): void; /** * Triggers all scripts that hasn't been triggered yet */ scriptTrigger(): void; /** * Loads all exported Commands inside of the given Path * (goes also through the subfolders) * @param target_path - The Path that should be crawled for exported Commands * @example * const path = require("path"); * client.loadCommands(path.join(__dirname,"commands")); */ loadCommands(target_path: string): boolean; /** * Adds all exported Scripts inside of the given Path * @param target_path - The Path that should be crawled for exported Scripts */ loadScripts(target_path: string): boolean; /** * adds the .help command */ enableHelp(): void; /** * turns debug mode on */ enableDebug(): void; reload(file: any): void; full_destroy(): void; }