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.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”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.
Parameters
Section titled “Parameters”APIEmbed = {}
Returns
Section titled “Returns”Embed
Accessors
Section titled “Accessors”author
Section titled “author”Get Signature
Section titled “Get Signature”get author():
APIEmbedAuthor|undefined
Defined in: packages/structures/src/embed.ts:67
Embed author.
Returns
Section titled “Returns”APIEmbedAuthor | undefined
Get Signature
Section titled “Get Signature”get color():
number|undefined
Defined in: packages/structures/src/embed.ts:37
Embed color as an integer.
Returns
Section titled “Returns”number | undefined
createdAt
Section titled “createdAt”Get Signature
Section titled “Get Signature”get createdAt():
Date|undefined
Defined in: packages/structures/src/embed.ts:45
Embed timestamp as a Date object, or undefined.
Returns
Section titled “Returns”Date | undefined
description
Section titled “description”Get Signature
Section titled “Get Signature”get description():
string|undefined
Defined in: packages/structures/src/embed.ts:29
Embed description.
Returns
Section titled “Returns”string | undefined
fields
Section titled “fields”Get Signature
Section titled “Get Signature”get fields(): readonly
APIEmbedField[]
Defined in: packages/structures/src/embed.ts:71
Embed fields (read-only copy).
Returns
Section titled “Returns”readonly APIEmbedField[]
footer
Section titled “footer”Get Signature
Section titled “Get Signature”get footer():
APIEmbedFooter|undefined
Defined in: packages/structures/src/embed.ts:51
Embed footer.
Returns
Section titled “Returns”APIEmbedFooter | undefined
Get Signature
Section titled “Get Signature”get image():
APIEmbedMedia|undefined
Defined in: packages/structures/src/embed.ts:55
Embed image.
Returns
Section titled “Returns”APIEmbedMedia | undefined
thumbnail
Section titled “thumbnail”Get Signature
Section titled “Get Signature”get thumbnail():
APIEmbedMedia|undefined
Defined in: packages/structures/src/embed.ts:59
Embed thumbnail.
Returns
Section titled “Returns”APIEmbedMedia | undefined
timestamp
Section titled “timestamp”Get Signature
Section titled “Get Signature”get timestamp():
string|undefined
Defined in: packages/structures/src/embed.ts:41
Embed timestamp ISO 8601 string.
Returns
Section titled “Returns”string | undefined
Get Signature
Section titled “Get Signature”get title():
string|undefined
Defined in: packages/structures/src/embed.ts:25
Embed title.
Returns
Section titled “Returns”string | undefined
Get Signature
Section titled “Get Signature”get url():
string|undefined
Defined in: packages/structures/src/embed.ts:33
Embed URL.
Returns
Section titled “Returns”string | undefined
Get Signature
Section titled “Get Signature”get video():
APIEmbedMedia|undefined
Defined in: packages/structures/src/embed.ts:63
Embed video.
Returns
Section titled “Returns”APIEmbedMedia | undefined
Methods
Section titled “Methods”addFields()
Section titled “addFields()”addFields(…
fields):this
Defined in: packages/structures/src/embed.ts:158
Adds one or more fields to the embed.
Parameters
Section titled “Parameters”fields
Section titled “fields”Fields to add (max 25 total).
Returns
Section titled “Returns”this
Throws
Section titled “Throws”If adding exceeds 25 fields.
clearFields()
Section titled “clearFields()”clearFields():
this
Defined in: packages/structures/src/embed.ts:177
Removes all fields from the embed.
Returns
Section titled “Returns”this
setAuthor()
Section titled “setAuthor()”setAuthor(
name,options?):this
Defined in: packages/structures/src/embed.ts:141
Sets the embed author.
Parameters
Section titled “Parameters”string
Author name (max 256 chars).
options?
Section titled “options?”Optional URL and icon URL.
iconURL?
Section titled “iconURL?”string
string
Returns
Section titled “Returns”this
setColor()
Section titled “setColor()”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”).
Parameters
Section titled “Parameters”string | number
Color value.
Returns
Section titled “Returns”this
setDescription()
Section titled “setDescription()”setDescription(
description):this
Defined in: packages/structures/src/embed.ts:86
Sets the embed description.
Parameters
Section titled “Parameters”description
Section titled “description”string
Embed description (max 4096 chars).
Returns
Section titled “Returns”this
Throws
Section titled “Throws”If description exceeds 4096 characters.
setFooter()
Section titled “setFooter()”setFooter(
text,iconURL?):this
Defined in: packages/structures/src/embed.ts:119
Sets the embed footer.
Parameters
Section titled “Parameters”string
Footer text (max 2048 chars).
iconURL?
Section titled “iconURL?”string
Optional footer icon URL.
Returns
Section titled “Returns”this
setImage()
Section titled “setImage()”setImage(
url):this
Defined in: packages/structures/src/embed.ts:129
Sets the embed image.
Parameters
Section titled “Parameters”string
Image URL.
Returns
Section titled “Returns”this
setThumbnail()
Section titled “setThumbnail()”setThumbnail(
url):this
Defined in: packages/structures/src/embed.ts:135
Sets the embed thumbnail.
Parameters
Section titled “Parameters”string
Thumbnail URL.
Returns
Section titled “Returns”this
setTimestamp()
Section titled “setTimestamp()”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.
Parameters
Section titled “Parameters”timestamp?
Section titled “timestamp?”string | number | Date
Returns
Section titled “Returns”this
setTitle()
Section titled “setTitle()”setTitle(
title):this
Defined in: packages/structures/src/embed.ts:78
Sets the embed title.
Parameters
Section titled “Parameters”string
Embed title text (max 256 chars).
Returns
Section titled “Returns”this
Throws
Section titled “Throws”If title exceeds 256 characters.
setURL()
Section titled “setURL()”setURL(
url):this
Defined in: packages/structures/src/embed.ts:96
Sets the embed URL.
Parameters
Section titled “Parameters”string
A valid URL string.
Returns
Section titled “Returns”this
spliceFields()
Section titled “spliceFields()”spliceFields(
index,deleteCount, …fields):this
Defined in: packages/structures/src/embed.ts:183
Splices the fields array, replacing, inserting, or deleting fields.
Parameters
Section titled “Parameters”number
Start index.
deleteCount
Section titled “deleteCount”number
Number of fields to remove.
fields
Section titled “fields”Replacement fields.
Returns
Section titled “Returns”this
toJSON()
Section titled “toJSON()”toJSON():
APIEmbed
Defined in: packages/structures/src/embed.ts:209
Returns the raw Discord API embed payload.
Returns
Section titled “Returns”from()
Section titled “from()”
staticfrom(data):Embed
Defined in: packages/structures/src/embed.ts:216
Creates an Embed from an existing raw API embed object.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Embed