UNPKG

@jadl/cmd

Version:
27 lines (26 loc) 1.37 kB
import { APIModalSubmitInteraction, APITextInputComponent } from 'discord-api-types/v10'; import { APIInteraction } from 'discord-api-types/v9'; import { Worker } from 'jadl'; import { MessageReturnType } from '../handler/CommandHandler'; import { InteractionCommandResponse } from '../structures/InteractionCommandResponse'; import { WorkerInject } from '../structures/WorkerInject'; declare type ModalRunnerHandler<W extends Worker = Worker, D = undefined, OO extends ObjectOptions[] = []> = (options: { [key in OO[number]['name']]: string; } & D, worker: W, int: APIModalSubmitInteraction) => MessageReturnType | Promise<MessageReturnType> | void; interface ObjectOptions { name: string; } export declare class ModalRunner<W extends Worker = Worker, D = undefined, OO extends ObjectOptions[] = []> extends WorkerInject<W> { title: string; customId: string; private data; private handle?; constructor(title: string, customId?: string); setHandle(handle: ModalRunnerHandler<W, D, OO>): this; addTextInput<N extends string>(name: N, data: Omit<APITextInputComponent, 'custom_id' | 'label' | 'type'>, customId?: string): ModalRunner<W, D, [...OO, { name: N; }]>; _onInteraction(int: APIInteraction, worker: W): Promise<void>; render(extraInfo?: D): InteractionCommandResponse; } export {};