@jadl/cmd
Version:
A command handler for JADL
30 lines (29 loc) • 1.38 kB
TypeScript
import { APIMessageActionRowComponent, APIBaseInteraction, InteractionType, APIMessageComponentInteractionData, APIInteraction } from 'discord-api-types/v9';
import { Worker } from 'jadl';
import { MessageReturnType } from '../handler/CommandHandler';
import { WorkerInject } from '../structures/WorkerInject';
declare type ComponentHandle<T extends APIMessageActionRowComponent['type'], W extends Worker = Worker, D = any> = (int: APIBaseInteraction<InteractionType.MessageComponent, APIMessageComponentInteractionData & {
component_type: T;
}> & {
data: APIMessageComponentInteractionData & {
component_type: T;
};
}, worker: W, extraInfo?: D) => MessageReturnType | Promise<MessageReturnType> | void;
export declare class ComponentRunner<T extends APIMessageActionRowComponent['type'], W extends Worker = Worker, D = undefined> extends WorkerInject<W> {
component: APIMessageActionRowComponent & {
type: T;
custom_id: string;
};
private handle?;
constructor(component: APIMessageActionRowComponent & {
type: T;
custom_id: string;
});
_onInteraction(int: APIInteraction, worker: W): Promise<void>;
render(extraInfo?: D): APIMessageActionRowComponent & {
type: T;
custom_id: string;
};
setHandle(handle: ComponentHandle<T, W, D>): this;
}
export {};