Skip to content

ModalBuilder

ModalBuilder is used to construct a modal dialog for a Discord interaction, including title and components.

Usage:

local modal = ModalBuilder.new("modal_id")
:setTitle("Example Modal")
:addComponent(ButtonBuilder.new("button_id"))

Properties

The ModalBuilder instance has no set properties!

Methods

setTitle

ModalBuilder : setTitle (

     title: string
)  -> Builders.ModalBuilder

Sets the title of the modal.

addComponent

ModalBuilder : addComponent (

     componentObject: DiscordComponentTypes.DiscordComponent
)  -> Builders.ModalBuilder

Adds a component to the modal. The modal can contain up to five components.

toPayloadObject

ModalBuilder : toPayloadObject ()  -> Network.Resolvable

Converts the modal to a JSON object that can be sent to the Discord API.

Functions

new

ModalBuilder . new (

     modalId: string
)  -> ()

Creates a new instance of ModalBuilder.