Skip to content

Message

Implementation of discords Message object as a Luau builder.

https://discord.com/developers/docs/resources/message#message-object

Summary

Message.embeds  :: Embed }

Embedded rich content (up to 10 embeds).

Message.allowedMentions  :: AllowedMention?

Allowed mentions for the message.

Message.messageReference  :: Reference?

Include to make your message a reply.

Message.components  :: ActionRow }

Components to include with the message.

Message.stickerIds  :: { string }

IDs of up to 3 stickers in the server to send in the message.

Message.attachments  :: { Attachment }

Attachment objects with filename and description.

Message.flags  :: number?

Message flags combined as a bitfield.

Message.enforceNonce  :: boolean?

Whether to check nonce uniqueness.

Message.poll  :: Poll?

Poll data for the message.

Message : setContent ( content )  -> Message

Sets the content of the message.

Parameters

content: string

Returns

Message
Message : setNonce ( nonce )  -> Message

Sets the nonce of the message.

Parameters

nonce: string

Returns

Message
Message : setTTS ( tts )  -> Message

Sets whether the message is text-to-speech.

Parameters

tts: boolean

Returns

Message
Message : addEmbed ( embedData )  -> Message

Adds an embed to the message.

Parameters

embedData: JSON

Returns

Message
Message : setAllowedMentions ( mentions )  -> Message

Sets the allowed mentions for the message.

Parameters

mentions: JSON

Returns

Message
Message : setMessageReference ( ref )  -> Message

Sets the message reference.

Parameters

ref: JSON

Returns

Message
Message : addComponent ( component )  -> Message

Adds a component to the message.

Parameters

component: JSON

Returns

Message
Message : addStickerId ( stickerId )  -> Message

Adds a sticker ID to the message.

Parameters

stickerId: string

Returns

Message
Message : addAttachment ( data name )  -> Message

Adds an attachment to the message.

Parameters

data: string
name: string?

Returns

Message
Message : setFlags ( flags )  -> Message

Sets the flags for the message.

Parameters

flags: number

Returns

Message
Message : setEnforceNonce ( enforceNonce )  -> Message

If true and nonce is present, it will be checked for uniqueness in the past few minutes.

Parameters

enforceNonce: boolean

Returns

Message
Message : setPoll ( poll )  -> Message

Sets the poll for the message.

Parameters

poll: JSON

Returns

Message
Message : build ( )  -> JSON

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

Returns

JSON
Message . new ( resource )  -> Message

Responsible for creating a new Message.

Parameters

resource: {
content: string?,
nonce: string?,
tts: boolean?,
embeds: { embed.JSON,
}

Returns

Message