@ayanaware/bentocord
Version:
Bentocord is a Bento plugin designed to rapidly build fully functional Discord Bots.
29 lines (28 loc) • 1.34 kB
TypeScript
import { Message } from 'eris';
import { ComponentOperation } from '../components/ComponentOperation';
import { AnyComponentContext } from '../components/contexts/AnyComponentContext';
import type { AnyContext } from '../contexts/AnyContext';
import type { PossiblyTranslatable } from '../interfaces/Translatable';
import type { PromptManager } from './PromptManager';
export declare type PromptValidator<T = unknown> = (response: string) => Promise<[boolean, T]>;
export interface PromptOptions {
showCloseError?: boolean;
closeErrorFollowup?: boolean;
}
export declare const TEXT_CLOSE: string[];
export declare class Prompt<T = void> extends ComponentOperation<T> {
protected readonly pm: PromptManager;
protected validator: PromptValidator<T>;
protected options: PromptOptions;
protected hasHandler: boolean;
protected selfMessages: Array<Message>;
protected attempts: number;
constructor(ctx: AnyContext, validator?: PromptValidator<T>, options?: PromptOptions);
render(): Promise<void>;
protected handleInteraction(ctx: AnyComponentContext): Promise<void>;
handleResponse(response: string, message?: Message): Promise<void>;
protected handleTimeout(): Promise<void>;
start(): Promise<T>;
close(reason?: PossiblyTranslatable): Promise<void>;
cleanup(): Promise<void>;
}