import type { NonLinkButtonComponentBuilder, AdaptorButtonInteraction } from "../../adaptor"; import type { Awaitable } from "../../util/types"; export type ValidateResult = ValidateOkResult | ValidateErrorResult; export type ValidateOkResult = { ok: true; reason?: undefined; }; export type ValidateErrorResult = T extends undefined ? { ok: false; reason?: undefined; } : { ok: false; reason: T; }; export type ValidateResultState = (ValidateOkResult & { checked: true; }) | (ValidateErrorResult & { checked: true; }) | { ok: false; checked: false; reason?: undefined; }; export type UseConfirmButtonResult = [ result: ValidateResultState, ConfirmButton: NonLinkButtonComponentBuilder<{ customId: string; }> ]; export type UseConfirmButtonParams = { validate: () => Awaitable>; onConfirm?: () => Awaitable; deferInteractionAlways?: boolean; filter?: (interaction: Readonly) => boolean; }; /** * ボタンを押したときに検証を行い、検証が成功した場合のみonConfirmを実行する * @param validate ボタンが押されたときに実行される検証関数 * @param onConfirm validateが成功したときに実行される関数 * @param deferInteractionAlways validateの結果に関わらずinteractionをdeferUpdateするかどうか (デフォルトはtrue) * @param filter interactionに反応するかどうかのフィルタ falseを返すとdeferUpdateとonConfirmは実行されない * @returns [validateResult, ConfirmButton] */ export declare const useConfirmButtonComponent: ({ validate, onConfirm, deferInteractionAlways, filter, }: UseConfirmButtonParams) => UseConfirmButtonResult; //# sourceMappingURL=useConfirmButtonComponent.d.ts.map