import { TranslationString } from "./util/types"; import { TeamSpeak, TeamSpeakClient, TextMessageEvent } from "ts3-nodejs-library"; import { Command } from "./command/Command"; import { CommandGroup } from "./command/CommandGroup"; import { BaseCommand } from "./command/BaseCommand"; import { TooManyArgumentsError } from "./exceptions/TooManyArgumentsError"; import { ThrottleError } from "./exceptions/ThrottleError"; import { ParseError } from "./exceptions/ParseError"; import { PermissionError } from "./exceptions/PermissionError"; import { CommandNotFoundError } from "./exceptions/CommandNotFoundError"; import { Throttle } from "./util/Throttle"; export interface CommandErrorType { cmd: BaseCommand; error: T; } export interface TranslationMessages { COMMAND_NOT_FOUND: TranslationString; COMMAND_NO_PERMISSION: TranslationString>; SUBCOMMAND_NOT_FOUND: TranslationString>; COMMAND_PARSE_ERROR: TranslationString>; COMMAND_THROTTLE_ERROR: TranslationString>; COMMAND_TOO_MANY_ARGUMENTS_ERROR: TranslationString>; } export interface CommanderOptions extends TranslationMessages { prefix: string; } export declare class Commander { static DEFAULT_PREFIX: string; readonly config: CommanderOptions; private instances; private commands; constructor(config?: Partial); /** creates a new Throttle instance */ static createThrottle(): Throttle; private getTranslator; /** * retrieves a string from a CommanderString Type * @param data the string getter data */ private getTranslatedString; /** * gets a string translation with the client object * @param client */ translateString(client: TeamSpeakClient): (data: TranslationString) => string; private textMessageHandler; private runCommand; getReplyFunction(ev: TextMessageEvent): (msg: TranslationString<{}>) => Promise; checkPermissions(commands: BaseCommand[], client: TeamSpeakClient): Promise; /** * gets a list of enabled commands * @param name the name to find */ getAvailableCommands(name?: string): BaseCommand[]; /** * regex searches available commands * @param name the name to find * @param client the requesting client */ searchAvailableCommands(name: string, client: TeamSpeakClient): BaseCommand[]; /** * gets a list of availale commands with permission checks * @param client the client to check permissions for * @param filter the name to prefilter commands */ getAvailableCommandsWithPermission(client: TeamSpeakClient, filter?: string): Promise; prefix(): string; isPossibleCommand(text: string): boolean; /** * creates a new command * @param name the name of the command */ createCommand(name: string): Command; /** * creates a new command * @param name the name of the command */ createCommandGroup(name: string): CommandGroup; /** * adds a teamspeak instance to the command handler * @param teamspeak the instance to add * @param registerEvents depending on this setting the registerEvent command will be sent to the teamspeak server */ addInstance(teamspeak: TeamSpeak, registerEvents?: boolean): Promise; /** * checks if the command name is valid to be created as a command * @param name the command to create */ static isValidCommandName(name: string): boolean; }