@pubby/sdk
Version:
Pubby Development Kit
24 lines (23 loc) • 902 B
TypeScript
import { CommandsModule } from ".";
import { Pubby } from "../..";
import { PubbyMessage } from "../chat/message";
export declare type PromiseOr<T> = Promise<T> | T;
export declare type CommandHandler<T, R> = (message: PubbyMessage, context?: T) => PromiseOr<R>;
export interface CommandOptions<T extends object, R = boolean | void> {
enabled?: boolean;
command: string | string[];
context?(message?: PubbyMessage): T;
description: string;
usage?: string;
pipeline?: CommandHandler<T, R>[];
handler?: CommandHandler<T, R>;
}
export declare abstract class Command<A extends Record<string, any>> {
options: CommandOptions<any, any>;
commands: CommandsModule;
get pubby(): Pubby;
constructor(options: CommandOptions<any, any>);
get aliases(): any[];
private __handler__;
run(message: PubbyMessage, args: A): PromiseOr<any>;
}