Skip to content

Modal

Implementation of discords Modal object as a Luau builder.

https://discord.com/developers/docs/interactions/message-components#text-input-object-text-input-structure

Modal.customId  :: string?

The custom identifier for the modal.

Modal.title  :: string?

The title that appears at the top of the modal.

Modal.components  :: TextInput }?

The components that will be displayed in this modal.

Modal : setCustomId ( customId )  -> Modal

Sets the custom ID for this modal. This is required for the Discord API to identify this modal.

Parameters

customId: string

Returns

Modal
Modal : setTitle ( title )  -> Modal

Sets the title that appears at the top of the modal.

Parameters

title: string

Returns

Modal
Modal : setComponents ( components )  -> Modal

Sets the components that will be displayed in this modal. These must be text input components.

Parameters

components: JSON }

Returns

Modal
Modal : addLabel ( labelComponent )  -> Modal

Adds a Label component to the modal. Labels are the recommended replacement for ActionRow in modals.

Parameters

labelComponent: JSON

Returns

Modal
Modal : build ( )  -> JSON

Responsible for building the Modal JSON that can be parsed by the Discord API.

Returns

JSON
Modal . new ( resource )  -> Modal

Responsible for creating a new Modal.

local modal = Modal.new()
:setCustomId("my-modal")
:setTitle("My Modal")
:setComponents({textInput})
:build()

Parameters

resource: {
customId: string?,
title: string?,
components: { textInput.JSON,
}

Returns

Modal