# getConfirmation

`function` in `gateway` · v0.1.0-next.3

<https://docs.seedcord.org/packages/gateway/0.1.0-next.3/functions/get-confirmation>

Shows a confirm/cancel prompt with built-in Confirm and Cancel buttons and resolves to `true` only if the invoking user clicks confirm. A cancel click or a timeout resolves to `false`. Gate the action behind it with an early return. A failed prompt send throws into the fault boundary. Not usable from a [`ModalHandler`](/packages/gateway/0.1.0-next.3/classes/modal-handler), the `interaction` parameter excludes a modal submit at compile time.

## Signature 1

```ts
async getConfirmation(
    interaction: NonModalInteraction,
    prompt: string,
    options?: DefaultConfirmOptions
): Promise<boolean>
```

Shows a confirm/cancel prompt with built-in Confirm and Cancel buttons and resolves to `true` only if the invoking user clicks confirm. A cancel click or a timeout resolves to `false`. Gate the action behind it with an early return. A failed prompt send throws into the fault boundary. Not usable from a [`ModalHandler`](/packages/gateway/0.1.0-next.3/classes/modal-handler), the `interaction` parameter excludes a modal submit at compile time.

Parameters.

- `interaction` `NonModalInteraction` — The repliable interaction to prompt on, `this.event` inside a non-modal handler.
- `prompt` `string` — The message shown above the Confirm and Cancel buttons.
- `options?` `DefaultConfirmOptions` — Ephemeral flag, timeout, the built-in buttons' labels and style, and the optional `onConfirm`/`onCancel`/`onTimeout` outcome replies that edit the prompt in place.

Returns `Promise<boolean>`.

## Signature 2

```ts
async getConfirmation(
    interaction: NonModalInteraction,
    prompt: (ids: {
        confirm: string;
        cancel: string;
    }) => Promisable<ReplyResponse>,
    options?: ConfirmOptions
): Promise<boolean>
```

Shows a confirm/cancel prompt you build yourself and resolves to `true` only if the invoking user clicks confirm. The factory receives the two minted button ids. Set them on your own buttons. A cancel click or a timeout resolves to `false`. A failed prompt send throws into the fault boundary. Not usable from a [`ModalHandler`](/packages/gateway/0.1.0-next.3/classes/modal-handler).

The prompt is collected in-process, so it does not survive a bot restart. Without an outcome hook, deliver a result after confirming with a fresh `interaction.followUp(...)`, the prompt is already gone.

Parameters.

- `interaction` `NonModalInteraction` — The repliable interaction to prompt on, `this.event` inside a non-modal handler.
- `prompt` `(ids: { confirm: string; cancel: string; }) => Promisable<ReplyResponse>` — A factory given the minted `{ confirm, cancel }` ids that returns the reply to show. Build it with the kit `BuilderComponent`/`RowComponent` wrappers, not raw discord.js builders.
- `options?` `ConfirmOptions` — Ephemeral flag, timeout, and the optional `onConfirm`/`onCancel`/`onTimeout` outcome replies that edit the prompt in place.

Returns `Promise<boolean>`.
