Appearance
EmbedBuilder
Package: @erinjs/builders
Builder for creating rich embeds. Use toJSON() when passing to reply, send, or edit. Embeds must have at least one of: title, description, fields, or image/thumbnail. A description-only embed (no title) is valid.
Properties
| Name | Type | Readonly | Optional | Description |
|---|---|---|---|---|
data | APIEmbed | Yes | No |
Methods
addFields()
Add one or more fields. Max 25 fields.
Returns: this
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
fields | EmbedFieldData[] | No |
from()
Create an EmbedBuilder from an existing API embed.
Returns: EmbedBuilder
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
data | APIEmbed | No |
setAudio()
Set the embed audio. Supported by erin.js.
Returns: this
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
input | string | EmbedMediaOptions | null | No | Audio URL, full media options, or null to clear |
setAuthor()
Set the embed author (name, optional icon URL and link).
Returns: this
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
options | EmbedAuthorOptions | null | No |
setColor()
Set the embed color. Number (hex), hex string, or [r,g,b] array.
Returns: this
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
color | string | number | [number, number, number] | null | No |
setDescription()
Set the embed description. Max 4096 characters.
Returns: this
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
description | string | null | No |
setFooter()
Set the embed footer (text, optional icon URL).
Returns: this
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
options | EmbedFooterOptions | null | No |
setImage()
Set the embed image (URL string or full media options).
Returns: this
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
input | string | EmbedMediaOptions | null | No |
setThumbnail()
Set the embed thumbnail (URL string or full media options).
Returns: this
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
input | string | EmbedMediaOptions | null | No |
setTimestamp()
Set the embed timestamp. Omit for current time.
Returns: this
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
timestamp | number | Date | null | Yes |
setTitle()
Set the embed title. Max 256 characters.
Returns: this
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
title | string | null | No |
setURL()
Set the embed URL (title becomes a link).
Returns: this
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
url | string | null | No |
setVideo()
Set the embed video. Supported by erin.js. Embed stays type 'rich'; this adds the .video field. Include a title (e.g. setTitle) when using video.
Returns: this
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
input | string | EmbedMediaOptions | null | No | Video URL, full media options (e.g. duration for progress bars), or null to clear |
spliceFields()
Returns: this
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
index | number | No | |
deleteCount | number | No | |
fields | EmbedFieldData[] | No |
toJSON()
Convert to API embed format for reply, send, or edit.
Returns: APIEmbed
Parameters:
None