declare class MessageBuilder implements JSONEncodable<RESTPostAPIChannelMessageJSONBody>
A builder that creates API-compatible JSON data for messages.
readonlyexternalreadonly AttachmentBuilder[] attachments :
Gets the attachments of this message.
readonlyexternalreadonly MessageTopLevelComponentBuilder[] components :
Gets the components of this message.
readonlyexternalreadonly EmbedBuilder[] embeds :
Gets the embeds of this message.
external addActionRowComponents...components: RestOrArray<ActionRowBuilder | APIActionRowComponent<APIComponentInMessageActionRow$1> | ((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 setAllowedMentionsallowedMentions: 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 setContentcontent: 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 setEnforceNonceenforceNonce?: boolean) : this (
Sets whether to enforce recent uniqueness of the nonce of this message.
external setFlagsflags: MessageFlags) : this (
Sets the flags for this message.
external setMessageReferencereference: APIMessageReference | MessageReferenceBuilder | ((builder: MessageReferenceBuilder) => MessageReferenceBuilder)) : this (
Sets the message reference for this message.
external setPollpoll: 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 setTTStts?: boolean) : this (
Sets whether the message is TTS.
external spliceAttachmentsstart: 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 spliceComponentsstart: 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 spliceEmbedsstart: 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 toJSONvalidationOverride?: 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 updateAllowedMentionsupdater: (builder: AllowedMentionsBuilder) => void) : this (
Updates the allowed mentions for this message (and creates it if it doesn't exist)
external updateMessageReferenceupdater: (builder: MessageReferenceBuilder) => void) : this (
Updates the message reference for this message (and creates it if it doesn't exist)
external updatePollupdater: (builder: PollBuilder) => void) : this (
Updates the poll for this message (and creates it if it doesn't exist)