class EmbedBuilder
implements
JSONEncodable<APIEmbed>export declare class EmbedBuilder implements JSONEncodable<APIEmbed>
A builder that creates API-compatible JSON data for embeds.
readonlyreadonly EmbedFieldBuilder[] fields :
Gets the fields of this embed.
addFields...fields: RestOrArray<APIEmbedField | EmbedFieldBuilder | ((builder: EmbedFieldBuilder) => EmbedFieldBuilder)>) : this (
...fields: RestOrArray<APIEmbedField | EmbedFieldBuilder | ((builder: EmbedFieldBuilder) => EmbedFieldBuilder)>
Appends fields to the embed.
Examples:Using an array:Using rest parameters (variadic):
const fields: APIEmbedField[] = ...;
const embed = new EmbedBuilder()
.addFields(fields);
const embed = new EmbedBuilder()
.addFields(
{ name: 'Field 1', value: 'Value 1' },
{ name: 'Field 2', value: 'Value 2' },
);
setAuthoroptions: APIEmbedAuthor | EmbedAuthorBuilder | ((builder: EmbedAuthorBuilder) => EmbedAuthorBuilder)) : this (
options: APIEmbedAuthor | EmbedAuthorBuilder | ((builder: EmbedAuthorBuilder) => EmbedAuthorBuilder)
Sets the author of this embed.
setColorcolor: number) : this (
color: number
Sets the color of this embed.
setDescriptiondescription: string) : this (
description: string
Sets the description of this embed.
setFields...fields: RestOrArray<APIEmbedField | EmbedFieldBuilder | ((builder: EmbedFieldBuilder) => EmbedFieldBuilder)>) : this (
...fields: RestOrArray<APIEmbedField | EmbedFieldBuilder | ((builder: EmbedFieldBuilder) => EmbedFieldBuilder)>
Sets the fields for this embed.
setFooteroptions: APIEmbedFooter | EmbedFooterBuilder | ((builder: EmbedFooterBuilder) => EmbedFooterBuilder)) : this (
options: APIEmbedFooter | EmbedFooterBuilder | ((builder: EmbedFooterBuilder) => EmbedFooterBuilder)
Sets the footer of this embed.
setImageurl: string) : this (
url: string
Sets the image of this embed.
setThumbnailurl: string) : this (
url: string
Sets the thumbnail of this embed.
setTitletitle: string) : this (
title: string
Sets the title for this embed.
setURLurl: string) : this (
url: string
Sets the URL of this embed.
spliceFieldsindex: numberdeleteCount: number...fields: (APIEmbedField | EmbedFieldBuilder | ((builder: EmbedFieldBuilder) => EmbedFieldBuilder))[]) : this (
index: number
deleteCount: number
...fields: (APIEmbedField | EmbedFieldBuilder | ((builder: EmbedFieldBuilder) => EmbedFieldBuilder))[]
Removes, replaces, or inserts fields for this embed.
Examples:Remove the first field:Remove the first n fields:Remove the last field:
embed.spliceFields(0, 1);
const n = 4;
embed.spliceFields(0, n);
embed.spliceFields(-1, 1);
Serializes this builder to API-compatible JSON data.Note that by disabling validation, there is no guarantee that the resulting object will be valid.
updateAuthorupdater: (builder: EmbedAuthorBuilder) => void) : this (
updater: (builder: EmbedAuthorBuilder) => void
Updates the author of this embed (and creates it if it doesn't exist).
updateFooterupdater: (builder: EmbedFooterBuilder) => void) : this (
updater: (builder: EmbedFooterBuilder) => void
Updates the footer of this embed (and creates it if it doesn't exist).