declare class MessageBuilder implements JSONEncodable<RESTPostAPIChannelMessageJSONBody>A builder that creates API-compatible JSON data for messages.
readonlyexternalattachments : readonly AttachmentBuilder[]
Gets the attachments of this message.
readonlyexternalcomponents : readonly MessageTopLevelComponentBuilder[]
Gets the components of this message.
readonlyexternalembeds : readonly EmbedBuilder[]
Gets the embeds of this message.
external addActionRowComponents(...components: RestOrArray<ActionRowBuilder | APIActionRowComponent<APIComponentInMessageActionRow> | ((builder: ActionRowBuilder) => ActionRowBuilder)>) : this
Adds action row components to this message.
external addAttachments(...attachments: RestOrArray<APIAttachment | AttachmentBuilder | ((builder: AttachmentBuilder) => AttachmentBuilder)>) : this
Adds attachments to this message.
external addContainerComponents(...components: RestOrArray<APIContainerComponent | ContainerBuilder | ((builder: ContainerBuilder) => ContainerBuilder)>) : this
Adds container components to this message.
external addEmbeds(...embeds: RestOrArray<APIEmbed | EmbedBuilder | ((builder: EmbedBuilder) => EmbedBuilder)>) : this
Appends embeds to this message.
const embeds: APIEmbed[] = ...;
const message = new MessageBuilder()
.addEmbeds(embeds);const message = new MessageBuilder()
.addEmbeds(
{ title: 'Embed 1' },
{ title: 'Embed 2' },
);external addFileComponents(...components: RestOrArray<APIFileComponent | FileBuilder | ((builder: FileBuilder) => FileBuilder)>) : this
Adds file components to this message.
external addMediaGalleryComponents(...components: RestOrArray<APIMediaGalleryComponent | MediaGalleryBuilder | ((builder: MediaGalleryBuilder) => MediaGalleryBuilder)>) : this
Adds media gallery components to this message.
external addSectionComponents(...components: RestOrArray<APISectionComponent | SectionBuilder | ((builder: SectionBuilder) => SectionBuilder)>) : this
Adds section components to this message.
external addSeparatorComponents(...components: RestOrArray<APISeparatorComponent | SeparatorBuilder | ((builder: SeparatorBuilder) => SeparatorBuilder)>) : this
Adds separator components to this message.
external addStickerIds(...stickerIds: RestOrArray<Snowflake>) : this
Adds sticker ids to this message.
external addTextDisplayComponents(...components: RestOrArray<APITextDisplayComponent | TextDisplayBuilder | ((builder: TextDisplayBuilder) => TextDisplayBuilder)>) : this
Adds text display components to this message.
external setAllowedMentions(allowedMentions: AllowedMentionsBuilder | APIAllowedMentions | ((builder: AllowedMentionsBuilder) => AllowedMentionsBuilder)) : this
Sets the allowed mentions for this message.
external setAttachments(...attachments: RestOrArray<APIAttachment | AttachmentBuilder | ((builder: AttachmentBuilder) => AttachmentBuilder)>) : this
Sets attachments for this message.
external setContent(content: string) : this
Sets the content of the message.
external setEmbeds(...embeds: RestOrArray<APIEmbed | EmbedBuilder | ((builder: EmbedBuilder) => EmbedBuilder)>) : this
Sets the embeds for this message.
external setEnforceNonce(enforceNonce?: boolean) : this
Sets whether to enforce recent uniqueness of the nonce of this message.
external setFlags(flags: MessageFlags) : this
Sets the flags for this message.
external setMessageReference(reference: APIMessageReference | MessageReferenceBuilder | ((builder: MessageReferenceBuilder) => MessageReferenceBuilder)) : this
Sets the message reference for this message.
external setPoll(poll: APIPoll | PollBuilder | ((builder: PollBuilder) => PollBuilder)) : this
Sets the poll for this message.
external setStickerIds(...stickerIds: RestOrArray<Snowflake>) : this
Sets the sticker ids of this message.
external setTTS(tts?: boolean) : this
Sets whether the message is TTS.
external spliceAttachments(start: numberdeleteCount: number...attachments: RestOrArray<APIAttachment | AttachmentBuilder | ((builder: AttachmentBuilder) => AttachmentBuilder)>) : this
Removes, replaces, or inserts attachments for this message.
message.spliceAttachments(0, 1);const n = 4;
message.spliceAttachments(0, n);message.spliceAttachments(-1, 1);external spliceComponents(start: numberdeleteCount: number...components: RestOrArray<APIMessageTopLevelComponent | MessageTopLevelComponentBuilder>) : this
Removes, replaces, or inserts components for this message.
message.spliceComponents(0, 1);const n = 4;
message.spliceComponents(0, n);message.spliceComponents(-1, 1);external spliceEmbeds(start: numberdeleteCount: number...embeds: RestOrArray<APIEmbed | EmbedBuilder | ((builder: EmbedBuilder) => EmbedBuilder)>) : this
Removes, replaces, or inserts embeds for this message.
message.spliceEmbeds(0, 1);const n = 4;
message.spliceEmbeds(0, n);message.spliceEmbeds(-1, 1);Removes, replaces, or inserts sticker ids for this message.
message.spliceStickerIds(0, 1);const n = 4;
message.spliceStickerIds(0, n);message.spliceStickerIds(-1, 1);external toJSON(validationOverride?: boolean) : RESTPostAPIChannelMessageJSONBody
Serializes this builder to API-compatible JSON data.Note that by disabling validation, there is no guarantee that the resulting object will be valid.
external updateAllowedMentions(updater: (builder: AllowedMentionsBuilder) => void) : this
Updates the allowed mentions for this message (and creates it if it doesn't exist)
external updateMessageReference(updater: (builder: MessageReferenceBuilder) => void) : this
Updates the message reference for this message (and creates it if it doesn't exist)
external updatePoll(updater: (builder: PollBuilder) => void) : this
Updates the poll for this message (and creates it if it doesn't exist)