class EmbedBuilder

export declare class EmbedBuilder

Represents a embed in a message (image/video preview, rich embed, etc.)

Constructors

constructor(
data?: APIEmbed
)

Constructs a new instance of the EmbedBuilder class

readonly
data : APIEmbed

addFields() : this

Appends fields to the embed

Examples:Using an array
const fields: APIEmbedField[] = ...;
const embed = new EmbedBuilder()
	.addFields(fields);
Using rest parameters (variadic)
const embed = new EmbedBuilder()
	.addFields(
		{ name: 'Field 1', value: 'Value 1' },
		{ name: 'Field 2', value: 'Value 2' },
	);

setAuthor(
options: EmbedAuthorOptions | null
) : this

Sets the author of this embed

setColor(
color: RGBTuple | number | null
) : this

Sets the color of this embed

setDescription(
description: string | null
) : this

Sets the description of this embed

setFields() : this

Sets the embed's fields

setFooter(
options: EmbedFooterOptions | null
) : this

Sets the footer of this embed

setImage(
url: string | null
) : this

Sets the image of this embed

setThumbnail(
url: string | null
) : this

Sets the thumbnail of this embed

setTimestamp(
timestamp?: Date | number | null
) : this

Sets the timestamp of this embed

setTitle(
title: string | null
) : this

Sets the title of this embed

setURL(
url: string | null
) : this

Sets the URL of this embed

spliceFields(
index: number
deleteCount: number
fields: APIEmbedField[]
) : this

Removes, replaces, or inserts fields in the embed.

Examples:Remove the first field
embed.spliceFields(0, 1);
Remove the first n fields
const n = 4
embed.spliceFields(0, n);
Remove the last field
embed.spliceFields(-1, 1);

toJSON() : APIEmbed

Transforms the embed to a plain object