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

Properties

The Modal instance has no set properties!

Methods

The Modal instance has no set methods!

Functions

setCustomId

Modal . setCustomId (

     self: Modal
     customId: string
)  -> ()

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

setTitle

Modal . setTitle (

     self: Modal
     title: string
)  -> ()

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

setComponents

Modal . setComponents (

     self: Modal
     components: { textInput.JSON }
)  -> ()

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

build

Modal . build (

     self: Modal
)  -> ()

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

new

Modal . new (

     resource: {
       customId: string?,
       title: string?,
       components: { textInput.JSON,
    }
)  -> ()

Responsible for creating a new Modal.

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