Class

MessagePayload

Fluent message builder (camelCase setters → snake_case via toJSON). Prefer passing the builder to `channel.send(payload)` / `prepareMessagePostPayload(payload)` in `@fluxerjs/core` so defaults (allowed mentions, reply ping) apply. Use toJSON only for low-level REST bodies.

Constructor

new MessagePayload()

Properties

ContentMaxLength: (readonly)

Max content length (2000 characters).

data: MessagePayloadData (readonly)

Partial message data (built incrementally via setters).

Methods

addEmbed(embed: RESTPostAPIEmbed | EmbedBuilder): this

Add an embed (up to 10 total). Existing embeds are preserved.

ParamTypeDescription
embedRESTPostAPIEmbed | EmbedBuilder

Embed object or EmbedBuilder

create(contentOrOptions?: string | MessagePayloadCreateOptions): MessagePayload

Create from string content or options object.

ParamTypeDescription
contentOrOptions?string | MessagePayloadCreateOptions

Text content or full payload options

setAllowedMentions(allowedMentions: APIAllowedMentions | null): this

Set allowed mentions (controls who can be pinged). Pass null to clear.

ParamTypeDescription
allowedMentionsAPIAllowedMentions | null

Allowed mention rules, or null

setAttachments(attachments: AttachmentInput[] | null): this

Set attachments metadata (file bytes sent separately via multipart). Pass null to clear.

ParamTypeDescription
attachmentsAttachmentInput[] | null

Array of AttachmentBuilder or attachment metadata, or null

setContent(content: string | null): this

Set message content (max 2000 characters). Pass null to clear.

ParamTypeDescription
contentstring | null

Text content or null

setEmbeds(embeds: (RESTPostAPIEmbed | EmbedBuilder)[] | null): this

Replace all embeds (max 10). Pass null or empty array to clear.

ParamTypeDescription
embeds(RESTPostAPIEmbed | EmbedBuilder)[] | null

Array of embed objects or EmbedBuilder instances, or null

setFlags(flags: number): this

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

ParamTypeDescription
flagsnumber

Message flags bitfield

setReply(reference: ReplyInput | null): this

Set message reference (reply target). Pass null to clear.

ParamTypeDescription
referenceReplyInput | null

Reply target (channel/message IDs), or null

setTTS(tts: boolean): this

Set text-to-speech flag.

ParamTypeDescription
ttsboolean

Whether to use TTS

Serialize to API payload (snake_case keys).