N

dialogs

namespace dialogs

Functions

F

alert<T extends PlainMessageKey, B extends keyof Messages = never>(title: T, options?: AlertOptions<T, B>): Promise<void><T extends VarsMessageKey, B extends keyof Messages = never>(title: T, options: AlertOptions<T, B>): Promise<void>

Tells the user something in a dialog with one button, each text a message key.

Returns

A promise that resolves once the dialog closes, however it closes.

F

confirm<T extends keyof Messages, B extends keyof Messages = never>(title: T, options: ConfirmOptions<T, B>): Promise<boolean>

Asks a yes-or-no question with a confirm and a cancel button, each text a message key.

Returns

Whether the user confirmed; cancel, the backdrop, the back gesture or a dismiss resolve false.

F

dismissAll(): void

Closes every dialog this API opened, running each one's onDismiss.

Opens a dialog with Discord's own alert: a title, an optional body and custom component, and action buttons, each of which closes the dialog before running its handler. On a Discord build without the alert it falls back to the system alert, which shows the title, body and buttons only.

Returns

The dialog's key and a function that closes it.

Types

What showDialog shows: a title, an optional body and custom content, and buttons.

What alert shows after its title key: the body and button keys, and the title's and body's vars.

The optional body key of a dialog, and its vars when the message has placeholders.

What confirm asks after its title key: the body and button keys, and the title's and body's vars.

One action button in a dialog opened by showDialog.

A dialog button's style; the system alert fallback only distinguishes destructive.

The props a dialog's custom content component receives.

An open dialog, as showDialog returns it.

An options field holding a key's placeholder values: required when the key has placeholders, absent otherwise.

A message key whose en-US text has no placeholders.

A message key whose en-US text has placeholders.