seyfert
Version:
The most advanced framework for discord bots
44 lines (43 loc) • 2.85 kB
TypeScript
import type { EntryPointCommand } from '.';
import type { Logger, NulleableCoalising, OmitInsert } from '../common';
import { BaseHandler } from '../common';
import { type APIApplicationCommandOption, type LocalizationMap } from '../types';
import { Command, type CommandOption, SubCommand } from './applications/chat';
import { ContextMenuCommand } from './applications/menu';
import { type UsingClient } from './applications/shared';
export declare class CommandHandler extends BaseHandler {
protected logger: Logger;
protected client: UsingClient;
values: (Command | ContextMenuCommand)[];
entryPoint: EntryPointCommand | null;
filter: (path: string) => boolean;
constructor(logger: Logger, client: UsingClient);
reload(resolve: string | Command): Promise<void>;
reloadAll(stopIfFail?: boolean): Promise<void>;
protected shouldUploadLocales(locales?: LocalizationMap | null, cachedLocales?: LocalizationMap | null): boolean;
protected shoudUploadChoices(option: APIApplicationCommandOption, cached: APIApplicationCommandOption): boolean;
protected shouldUploadOption(option: APIApplicationCommandOption, cached: APIApplicationCommandOption): boolean;
shouldUpload(file: string, guildId?: string): Promise<boolean>;
set(commands: SeteableCommand[]): void;
load(commandsDir: string, client: UsingClient): Promise<(Command | ContextMenuCommand)[]>;
parseLocales(command: InstanceType<HandleableCommand>): Command | ContextMenuCommand | SubCommand | EntryPointCommand;
parseGlobalLocales(command: InstanceType<HandleableCommand>): void;
parseCommandOptionLocales(option: CommandOption): void;
parseCommandLocales(command: Command): void;
parseContextMenuLocales(command: ContextMenuCommand): ContextMenuCommand;
parseSubCommandLocales(command: SubCommand): SubCommand;
stablishContextCommandDefaults(commandInstance: InstanceType<HandleableCommand>): ContextMenuCommand | false;
stablishCommandDefaults(commandInstance: InstanceType<HandleableCommand>): OmitInsert<Command, 'options', {
options: NonNullable<Command['options']>;
}> | false;
stablishSubCommandDefaults(commandInstance: Command, option: SubCommand): SubCommand;
onFile(file: FileLoaded): HandleableCommand[] | undefined;
onCommand(file: HandleableCommand): InstanceType<HandleableCommand> | false;
onSubCommand(file: HandleableSubCommand): SubCommand | false;
}
export type FileLoaded<T = null> = {
default?: NulleableCoalising<T, HandleableCommand>;
} & Record<string, NulleableCoalising<T, HandleableCommand>>;
export type HandleableCommand = new () => Command | SubCommand | ContextMenuCommand | EntryPointCommand;
export type SeteableCommand = new () => Extract<InstanceType<HandleableCommand>, SubCommand>;
export type HandleableSubCommand = new () => SubCommand;