Skip to content

MessagePayload

Package: @erinjs/builders

Builder for message payloads. Use with channel.send() or message.reply().

Properties

NameTypeReadonlyOptionalDescription
ContentMaxLength2000YesNo
dataMessagePayloadDataYesNo

Methods

addEmbed()

Add one embed. Max 10 total.

Returns: this

Parameters:

NameTypeOptionalDescription
embedanyNo

create()

Create a MessagePayload from a string or options object.

Returns: MessagePayload

Parameters:

NameTypeOptionalDescription
contentOrOptionsstring | MessagePayloadDataYes

setAttachments()

Set attachment metadata (for files sent with the request).

Returns: this

Parameters:

NameTypeOptionalDescription
attachments(AttachmentBuilder | { id: number; filename: string; description?: string | null; })[] | nullNo

setContent()

Set message text. Max 2000 characters.

Returns: this

Parameters:

NameTypeOptionalDescription
contentstring | nullNo

setEmbeds()

Set embeds. Max 10. Replaces existing.

Returns: this

Parameters:

NameTypeOptionalDescription
embedsany[] | nullNo

setFlags()

Set message flags (e.g. ephemeral, suppress embeds).

Returns: this

Parameters:

NameTypeOptionalDescription
flagsnumberNo

setReply()

Set reply reference (creates a reply to another message).

Returns: this

Parameters:

NameTypeOptionalDescription
referenceanyNo

setTTS()

Enable text-to-speech.

Returns: this

Parameters:

NameTypeOptionalDescription
ttsbooleanNo

toJSON()

Get the payload as a plain object.

Returns: MessagePayloadData

Parameters:

None

Released under the Apache-2.0 License.