EmbedBuilder
Represents a embed in a message (image/video preview, rich embed, etc.)
constructor(data?)
Constructs a new instance of the
EmbedBuilder
className | Type | Optional | Description |
---|---|---|---|
data | APIEmbed | Yes | None |
Readonly
Appends fields to the embed
Remarks
This method accepts either an array of fields or a variable number of field parameters. The maximum amount of fields that can be added is 25.Example
Using an arrayExample
Using rest parameters (variadic)Name | Type | Optional | Description |
---|---|---|---|
fields | RestOrArray<APIEmbedField> | No | The fields to add |
Sets the author of this embed
Name | Type | Optional | Description |
---|---|---|---|
options | EmbedAuthorOptions | null | No | The options for the author |
Sets the color of this embed
Name | Type | Optional | Description |
---|---|---|---|
color | number | RGBTuple | null | No | The color of the embed |
Sets the description of this embed
Name | Type | Optional | Description |
---|---|---|---|
description | string | null | No | The description |
Sets the embed's fields
Remarks
This method is an alias for spliceFields. More specifically, it splices the entire array of fields, replacing them with the provided fields.You can set a maximum of 25 fields.Name | Type | Optional | Description |
---|---|---|---|
fields | RestOrArray<APIEmbedField> | No | The fields to set |
Sets the footer of this embed
Name | Type | Optional | Description |
---|---|---|---|
options | EmbedFooterOptions | null | No | The options for the footer |
Sets the image of this embed
Name | Type | Optional | Description |
---|---|---|---|
url | string | null | No | The URL of the image |
Sets the thumbnail of this embed
Name | Type | Optional | Description |
---|---|---|---|
url | string | null | No | The URL of the thumbnail |
Sets the timestamp of this embed
Name | Type | Optional | Description |
---|---|---|---|
timestamp | number | Date | null | Yes | The timestamp or date |
Sets the title of this embed
Name | Type | Optional | Description |
---|---|---|---|
title | string | null | No | The title |
Sets the URL of this embed
Name | Type | Optional | Description |
---|---|---|---|
url | string | null | No | The URL |
Removes, replaces, or inserts fields in the embed.
Remarks
This method behaves similarly to Array.prototype.splice. The maximum amount of fields that can be added is 25.It's useful for modifying and adjusting order of the already-existing fields of an embed.Example
Remove the first fieldExample
Remove the first n fieldsExample
Remove the last fieldName | Type | Optional | Description |
---|---|---|---|
index | number | No | The index to start at |
deleteCount | number | No | The number of fields to remove |
fields | APIEmbedField[] | No | The replacing field objects |
Transforms the embed to a plain object