Embed

Represents a message embed.

Signature

export declare class Embed
JSDoc
Examples
const embed = new Embed();
embed.setTitle('Seyfert');
embed.setDescription('Better than discord.js');
embed.setColor('Green');
const embedJSON = embed.json();

Properties

Methods

setAuthor(author?: ObjectToLower<APIEmbedAuthor>): this;

Sets the author of the embed.

Parameters
author
The author information.
Returns

The updated Embed instance.

Examples
embed.setAuthor({ name: 'John Doe', iconUrl: 'https://example.com/avatar.png' });
setColor(color?: ColorResolvable): this;

Sets the color of the embed.

Parameters
color
The color of the embed.
Returns

The updated Embed instance.

Examples
embed.setColor('#FF0000');
embed.setColor('Blurple');
setDescription(desc?: string): this;

Sets the description of the embed.

Parameters
desc
The description of the embed.
Returns

The updated Embed instance.

Examples
embed.setDescription('This is the description of the embed');
addFields(...fields: RestOrArray<APIEmbedField>): this;

Adds one or more fields to the embed.

Parameters
fields
The fields to add to the embed.
Returns

The updated Embed instance.

Examples
embed.addFields({ name: 'Field 1', value: 'Value 1' }, { name: 'Field 2', value: 'Value 2' });
setFields(fields?: APIEmbedField[]): this;

Sets the fields of the embed.

Parameters
fields
The fields of the embed.
Returns

The updated Embed instance.

Examples
embed.setFields([{ name: 'Field 1', value: 'Value 1' }, { name: 'Field 2', value: 'Value 2' }]);
setFooter(footer?: ObjectToLower<Omit<APIEmbedFooter, 'proxy_icon_url'>>): this;

Sets the footer of the embed.

Parameters
footer
The footer information.
Returns

The updated Embed instance.

Examples
embed.setFooter({ text: 'This is the footer', iconUrl: 'https://example.com/footer.png' });
setImage(url?: string): this;

Sets the image of the embed.

Parameters
url
The URL of the image.
Returns

The updated Embed instance.

Examples
embed.setImage('https://example.com/image.png');
setTimestamp(time?: string | number | Date): this;

Sets the timestamp of the embed.

Parameters
time
The timestamp value.
Returns

The updated Embed instance.

Examples
embed.setTimestamp();
embed.setTimestamp(1628761200000);
embed.setTimestamp(new Date());
setTitle(title?: string): this;

Sets the title of the embed.

Parameters
title
The title of the embed.
Returns

The updated Embed instance.

Examples
embed.setTitle('This is the title');
setURL(url?: string): this;

Sets the URL of the embed.

Parameters
url
The URL of the embed.
Returns

The updated Embed instance.

Examples
embed.setURL('https://seyfert.com');
setThumbnail(url?: string): this;

Sets the thumbnail of the embed.

Parameters
url
The URL of the thumbnail.
Returns

The updated Embed instance.

Examples
embed.setThumbnail('https://example.com/thumbnail.png');
toJSON(): APIEmbed;

Converts the Embed instance to a JSON object.

Returns

The JSON representation of the MessageEmbed instance.