Skip to content

MessageBuilder

MessageBuilder is used to construct a message that can be sent to a Discord channel, including content, embeds, components, and stickers.

Usage:

local message = MessageBuilder.new()
:setContent("Hello, world!")
:addEmbed(EmbedBuilder.new():setTitle("Embed Title"))
:addComponent(ButtonBuilder.new("button_id"))
:addStickerId("sticker_id")
:setTTSEnabled(true)

Properties

The MessageBuilder instance has no set properties!

Methods

toPayloadObject

MessageBuilder : toPayloadObject ()  -> Network.Resolvable

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

setContent

MessageBuilder : setContent (

     content: string
)  -> Builders.MessageBuilder

Sets the content of the message.

setNonce

MessageBuilder : setNonce (

     nonce: string
)  -> Builders.MessageBuilder

Sets the nonce of the message.

setTTSEnabled

MessageBuilder : setTTSEnabled (

     ttsEnabled: boolean
)  -> Builders.MessageBuilder

Sets whether text-to-speech (TTS) is enabled for the message.

addEmbed

MessageBuilder : addEmbed (

     embedBuilder: EmbedBuilder
)  -> Builders.MessageBuilder

Adds an embed to the message.

addComponent

MessageBuilder : addComponent (

     discordComponent: InterfaceBuilder
)  -> Builders.MessageBuilder

Adds a component to the message.

addStickerId

MessageBuilder : addStickerId (

     stickerId: string
)  -> Builders.MessageBuilder

Adds a sticker ID to the message.

setFlags

MessageBuilder : setFlags (

     flags: number
)  -> Builders.MessageBuilder

Sets the flags for the message.

addFile

MessageBuilder : addFile (

     fileContent: string
     fileName: string
)  -> Builders.MessageBuilder

Add a file to the Message object

toJsonObject

MessageBuilder : toJsonObject ()  -> table

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

toPayloadObject

MessageBuilder : toPayloadObject ()  -> Network.Resolvable

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

Functions

new

MessageBuilder . new ()  -> ()

Creates a new instance of MessageBuilder.