class EmbedBuilder

export declare class EmbedBuilder

A builder that creates API-compatible JSON data for embeds.

Constructors

constructor(
data?: APIEmbed
)

Creates a new embed from API data.

readonly
data : APIEmbed

The API data associated with this embed.

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() : 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 fields for this embed.

setFooter() : 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 for 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 for this 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

Serializes this builder to API-compatible JSON data.