ModalForm

Class representing a modal form.

This should be extended by classes representing individual modals.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
open val grid: WidgetGrid

A grid containing rows of widgets.

Link copied to clipboard
var id: String

ID representing this modal on Discord.

Link copied to clipboard
open override val timeout: Duration

How long to wait before we stop waiting for this modal to be submitted.

Link copied to clipboard
abstract var title: Key

The modal's title, shown on Discord.

Functions

Link copied to clipboard
suspend fun applyToBuilder(builder: ModalBuilder, locale: Locale)

Given a ModalBuilder, apply this modal's widgets for display on Discord.

Link copied to clipboard
suspend fun <T> awaitCompletion(callback: suspend (ModalSubmitInteraction?) -> T): T

Wait for this modal to be completed and call the callback. Parameter will be null if timed out.

Link copied to clipboard
open override fun getKoin(): Koin

Get the associated Koin instance.

Link copied to clipboard
fun lineText(coordinate: CoordinatePair? = null, builder: LineTextWidget.() -> Unit): LineTextWidget

A widget representing a single-line text input.

Link copied to clipboard
fun paragraphText(coordinate: CoordinatePair? = null, builder: ParagraphTextWidget.() -> Unit): ParagraphTextWidget

A widget representing a multi-line paragraph input.

Link copied to clipboard
suspend fun <T> sendAndAwait(context: ApplicationCommandContext, callback: suspend (ModalSubmitInteraction?) -> T): T

Convenience function that calls the basic sendAndAwait function with parameters taken from the current command context.

suspend fun <T> sendAndAwait(context: ComponentContext<*>, callback: suspend (ModalSubmitInteraction?) -> T): T

Convenience function that calls the basic sendAndAwait function with parameters taken from the current component context.

suspend fun <T, E : InteractionCreateEvent> sendAndAwait(context: EventContext<E>, callback: suspend (ModalSubmitInteraction?) -> T): T

Convenience function that calls the basic sendAndAwait function with parameters taken from the current event context.

suspend fun <T> sendAndAwait(locale: Locale, interaction: ModalParentInteractionBehavior, callback: suspend (ModalSubmitInteraction?) -> T): T

Convenience function to send this modal to the given interaction and await its completion, running the provided callback.

Link copied to clipboard
suspend fun sendAndDeferEphemeral(context: ApplicationCommandContext): EphemeralMessageInteractionResponseBehavior?
suspend fun sendAndDeferEphemeral(context: ComponentContext<*>): EphemeralMessageInteractionResponseBehavior?
suspend fun <E : InteractionCreateEvent> sendAndDeferEphemeral(context: EventContext<E>): EphemeralMessageInteractionResponseBehavior?

Convenience function that sends the modal, awaits its completion, and returns a deferred ephemeral interaction response.

Link copied to clipboard
suspend fun sendAndDeferPublic(context: ApplicationCommandContext): PublicMessageInteractionResponseBehavior?
suspend fun sendAndDeferPublic(context: ComponentContext<*>): PublicMessageInteractionResponseBehavior?
suspend fun <E : InteractionCreateEvent> sendAndDeferPublic(context: EventContext<E>): PublicMessageInteractionResponseBehavior?

Convenience function that sends the modal, awaits its completion, and returns a deferred public interaction response.

Link copied to clipboard

Return a translated modal title using the given locale.