Skip to content

Embed

Defined in: packages/structures/src/embed.ts:13

A rich Embed structure that wraps a Discord API embed object. Provides typed accessors and a fluent builder interface.

new Embed(data?): Embed

Defined in: packages/structures/src/embed.ts:17

Creates an Embed from raw Discord API data, or starts a blank embed.

APIEmbed = {}

Embed

get author(): APIEmbedAuthor | undefined

Defined in: packages/structures/src/embed.ts:67

Embed author.

APIEmbedAuthor | undefined


get color(): number | undefined

Defined in: packages/structures/src/embed.ts:37

Embed color as an integer.

number | undefined


get createdAt(): Date | undefined

Defined in: packages/structures/src/embed.ts:45

Embed timestamp as a Date object, or undefined.

Date | undefined


get description(): string | undefined

Defined in: packages/structures/src/embed.ts:29

Embed description.

string | undefined


get fields(): readonly APIEmbedField[]

Defined in: packages/structures/src/embed.ts:71

Embed fields (read-only copy).

readonly APIEmbedField[]


get footer(): APIEmbedFooter | undefined

Defined in: packages/structures/src/embed.ts:51

Embed footer.

APIEmbedFooter | undefined


get image(): APIEmbedMedia | undefined

Defined in: packages/structures/src/embed.ts:55

Embed image.

APIEmbedMedia | undefined


get thumbnail(): APIEmbedMedia | undefined

Defined in: packages/structures/src/embed.ts:59

Embed thumbnail.

APIEmbedMedia | undefined


get timestamp(): string | undefined

Defined in: packages/structures/src/embed.ts:41

Embed timestamp ISO 8601 string.

string | undefined


get title(): string | undefined

Defined in: packages/structures/src/embed.ts:25

Embed title.

string | undefined


get url(): string | undefined

Defined in: packages/structures/src/embed.ts:33

Embed URL.

string | undefined


get video(): APIEmbedMedia | undefined

Defined in: packages/structures/src/embed.ts:63

Embed video.

APIEmbedMedia | undefined

addFields(…fields): this

Defined in: packages/structures/src/embed.ts:158

Adds one or more fields to the embed.

…APIEmbedField[]

Fields to add (max 25 total).

this

If adding exceeds 25 fields.


clearFields(): this

Defined in: packages/structures/src/embed.ts:177

Removes all fields from the embed.

this


setAuthor(name, options?): this

Defined in: packages/structures/src/embed.ts:141

Sets the embed author.

string

Author name (max 256 chars).

Optional URL and icon URL.

string

string

this


setColor(color): this

Defined in: packages/structures/src/embed.ts:102

Sets the embed color. Accepts a hex number (0xff0000), decimal integer, or hex string (“#ff0000”).

string | number

Color value.

this


setDescription(description): this

Defined in: packages/structures/src/embed.ts:86

Sets the embed description.

string

Embed description (max 4096 chars).

this

If description exceeds 4096 characters.


setFooter(text, iconURL?): this

Defined in: packages/structures/src/embed.ts:119

Sets the embed footer.

string

Footer text (max 2048 chars).

string

Optional footer icon URL.

this


setImage(url): this

Defined in: packages/structures/src/embed.ts:129

Sets the embed image.

string

Image URL.

this


setThumbnail(url): this

Defined in: packages/structures/src/embed.ts:135

Sets the embed thumbnail.

string

Thumbnail URL.

this


setTimestamp(timestamp?): this

Defined in: packages/structures/src/embed.ts:113

Sets the embed timestamp. Accepts a Date, ISO string, or number (ms since epoch). Defaults to now.

string | number | Date

this


setTitle(title): this

Defined in: packages/structures/src/embed.ts:78

Sets the embed title.

string

Embed title text (max 256 chars).

this

If title exceeds 256 characters.


setURL(url): this

Defined in: packages/structures/src/embed.ts:96

Sets the embed URL.

string

A valid URL string.

this


spliceFields(index, deleteCount, …fields): this

Defined in: packages/structures/src/embed.ts:183

Splices the fields array, replacing, inserting, or deleting fields.

number

Start index.

number

Number of fields to remove.

…APIEmbedField[]

Replacement fields.

this


toJSON(): APIEmbed

Defined in: packages/structures/src/embed.ts:209

Returns the raw Discord API embed payload.

APIEmbed


static from(data): Embed

Defined in: packages/structures/src/embed.ts:216

Creates an Embed from an existing raw API embed object.

APIEmbed

Embed