Message
Implementation of discords Message object as a Luau builder.
https://discord.com/developers/docs/resources/message#message-object
Summary
Properties
Message.embeds :: { Builders.Embed }Message.allowedMentions :: Builders.Message.AllowedMention?Message.messageReference :: Builders.Message.Reference?Message.components :: { Builders.Message.Button | Builders.Message.TextInput | Builders.Message.SelectMenu | Builders.Message.ActionRow }Message.stickerIds :: { string }Message.attachments :: { Attachment }Message.flags :: number?Message.enforceNonce :: boolean?Message.poll :: Builders.Message.Poll?Methods
Message:setContent(content: string) → MessageMessage:setNonce(nonce: string) → MessageMessage:setTTS(tts: boolean) → MessageMessage:addEmbed(embedData: embed.JSON) → MessageMessage:setAllowedMentions(mentions: allowedMention.JSON) → MessageMessage:setMessageReference(ref: reference.JSON) → MessageMessage:addComponent(component: button.JSON | textInput.JSON | selectMenu.JSON | actionRow.JSON | textDisplay.JSON | separator.JSON | componentThumbnail.JSON | mediaGallery.JSON | file.JSON | section.JSON | container.JSON) → MessageMessage:addStickerId(stickerId: string) → MessageMessage:addAttachment(data: string, name: string?) → MessageMessage:setFlags(flags: number) → MessageMessage:setEnforceNonce(enforceNonce: boolean) → MessageMessage:setPoll(poll: poll.JSON) → MessageMessage:build() → JSONProperties
Section titled “Properties”embeds
Section titled “embeds”Embedded rich content (up to 10 embeds).
allowedMentions
Section titled “allowedMentions”Allowed mentions for the message.
messageReference
Section titled “messageReference”Include to make your message a reply.
components
Section titled “components”Components to include with the message.
stickerIds
Section titled “stickerIds”IDs of up to 3 stickers in the server to send in the message.
attachments
Section titled “attachments”Attachment objects with filename and description.
Message flags combined as a bitfield.
enforceNonce
Section titled “enforceNonce”Whether to check nonce uniqueness.
Poll data for the message.
Methods
Section titled “Methods”setContent
Section titled “setContent”Message : setContent ( content ) -> Message
Sets the content of the message.
Parameters
| content: string |
Returns
| Message |
setNonce
Section titled “setNonce”Message : setNonce ( nonce ) -> Message
Sets the nonce of the message.
Parameters
| nonce: string |
Returns
| Message |
setTTS
Section titled “setTTS”Message : setTTS ( tts ) -> Message
Sets whether the message is text-to-speech.
Parameters
| tts: boolean |
Returns
| Message |
addEmbed
Section titled “addEmbed”Message : addEmbed ( embedData ) -> Message
Adds an embed to the message.
Parameters
| embedData: JSON |
Returns
| Message |
setAllowedMentions
Section titled “setAllowedMentions”Message : setAllowedMentions ( mentions ) -> Message
Sets the allowed mentions for the message.
Parameters
| mentions: JSON |
Returns
| Message |
setMessageReference
Section titled “setMessageReference”Message : setMessageReference ( ref ) -> Message
Sets the message reference.
Parameters
| ref: JSON |
Returns
| Message |
addComponent
Section titled “addComponent”Message : addComponent ( component ) -> Message
Adds a component to the message.
Parameters
| component: JSON |
Returns
| Message |
addStickerId
Section titled “addStickerId”Message : addStickerId ( stickerId ) -> Message
Adds a sticker ID to the message.
Parameters
| stickerId: string |
Returns
| Message |
addAttachment
Section titled “addAttachment”Message : addAttachment ( data , name ) -> Message
Adds an attachment to the message.
setFlags
Section titled “setFlags”Message : setFlags ( flags ) -> Message
Sets the flags for the message.
Parameters
| flags: number |
Returns
| Message |
setEnforceNonce
Section titled “setEnforceNonce”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 |
setPoll
Section titled “setPoll”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 |
Functions
Section titled “Functions”Message . new ( resource ) -> Message
Responsible for creating a new Message.
Parameters
| resource: { content: string?, nonce: string?, tts: boolean?, embeds: { embed.JSON, } |
Returns
| Message |