Skip to content

CommandHandler

Signature

export declare class CommandHandler extends BaseHandler

Properties

filter: (path: string) => boolean;

Filters a file path.

Parameters
path
The path to filter.
Returns

`true` if the path passes the filter, otherwise `false`.

private reloadFile;

Reloads a command file the way `load()` reads it, through `onFile`, so a file can export several commands. Every command from the file is replaced, in place, by what it exports now, with the plugin load options applied to each; a transform returning `false` still removes its command. A file that fails to import or exports no command keeps its previous commands. As before this method existed, an `@AutoLoad` command's directory is not scanned again, so the reloaded command comes back without its auto-loaded subcommands.

Methods

reloadFiles(stopIfFail?: boolean): Promise<HandlerReloadResult>;

Reloads every loaded command file and reports which files reloaded and which failed or exported nothing. Failed files keep their previous commands. With `stopIfFail`, it stops at the first failed file and throws a `RELOAD_FAILED` error carrying the report instead of returning it.

reloadAll(stopIfFail?: boolean): Promise<void>;
shouldUpload(file: string, guildId?: string): Promise<boolean>;
protected getLocales(locale: string): ("bg" | "cs" | "da" | "de" | "el" | "en-GB" | "en-US" | "es-419" | "es-ES" | "fi" | "fr" | "hi" | "hr" | "hu" | "id" | "it" | "ja" | "ko" | "lt" | "nl" | "no" | "pl" | "pt-BR" | "ro" | "ru" | "sv-SE" | "th" | "tr" | "uk" | "vi" | "zh-CN" | "zh-TW")[];
protected getLocaleKey(locale: string, key: string, context: string): string | undefined;