A builder that creates API-compatible JSON data for embeds.
Implements
JSONEncodable<APIEmbed>Creates a new embed from API data.
Name | Type | Optional | Description |
---|---|---|---|
data | APIEmbed | Yes | The API data to create this embed with |
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 array:Example
Using rest parameters (variadic):Name | Type | Optional | Description |
---|---|---|---|
...fields | RestOrArray<APIEmbedField | EmbedFieldBuilder | ((builder: EmbedFieldBuilder) => EmbedFieldBuilder)> | No | The fields to add |
Clears the author of this embed.
Clears the color of this embed.
Clears the description of this embed.
Clears the footer of this embed.
Clears the image of this embed.
Clears the thumbnail of this embed.
Clears the timestamp of this embed.
Clears the title of this embed.
Clears the URL of this embed.
Sets the author of this embed.
Name | Type | Optional | Description |
---|---|---|---|
options | APIEmbedAuthor | EmbedAuthorBuilder | ((builder: EmbedAuthorBuilder) => EmbedAuthorBuilder) | No | The options to use |
Sets the color of this embed.
Name | Type | Optional | Description |
---|---|---|---|
color | number | No | The color to use |
Sets the description of this embed.
Name | Type | Optional | Description |
---|---|---|---|
description | string | No | The description to use |
Sets the fields for this embed.
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 | EmbedFieldBuilder | ((builder: EmbedFieldBuilder) => EmbedFieldBuilder)> | No | The fields to set |
Sets the footer of this embed.
Name | Type | Optional | Description |
---|---|---|---|
options | APIEmbedFooter | EmbedFooterBuilder | ((builder: EmbedFooterBuilder) => EmbedFooterBuilder) | No | The footer to use |
Sets the image of this embed.
Name | Type | Optional | Description |
---|---|---|---|
url | string | No | The image URL to use |
Sets the thumbnail of this embed.
Name | Type | Optional | Description |
---|---|---|---|
url | string | No | The thumbnail URL to use |
Sets the timestamp of this embed.
Sets the title for this embed.
Name | Type | Optional | Description |
---|---|---|---|
title | string | No | The title to use |
Sets the URL of this embed.
Name | Type | Optional | Description |
---|---|---|---|
url | string | No | The URL to use |
Removes, replaces, or inserts fields for this 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 field:Example
Remove the first n fields:Example
Remove the last field:Name | Type | Optional | Description |
---|---|---|---|
index | number | No | The index to start at |
deleteCount | number | No | The number of fields to remove |
...fields | (APIEmbedField | EmbedFieldBuilder | ((builder: EmbedFieldBuilder) => EmbedFieldBuilder))[] | No | The replacing field objects |
Serializes this builder to API-compatible JSON data.Note that by disabling validation, there is no guarantee that the resulting object will be valid.
Name | Type | Optional | Description |
---|---|---|---|
validationOverride | boolean | Yes | Force validation to run/not run regardless of your global preference |
Updates the author of this embed (and creates it if it doesn't exist).
Name | Type | Optional | Description |
---|---|---|---|
updater | (builder: EmbedAuthorBuilder) => void | No | The function to update the author with |
Updates the footer of this embed (and creates it if it doesn't exist).
Name | Type | Optional | Description |
---|---|---|---|
updater | (builder: EmbedFooterBuilder) => void | No | The function to update the footer with |