Embed
Represents a message embed.
Example
1const embed = new Embed();2embed.setTitle('Seyfert');3embed.setDescription('Better than discord.js');4embed.setColor('Green');5const embedJSON = embed.json();
Constructors
new Embed(data)
1new Embed(data: Partial<APIEmbed>): Embed
Creates a new instance of Embed.
Parameters
Parameter | Type | Description |
---|---|---|
data | Partial <APIEmbed > | The initial data for the embed. |
Returns
Example
1const embed = new Embed({ title: 'Hello', description: 'This is an example embed' });
Source
seyfert/src/builders/Embed.ts:20
Properties
Property | Modifier | Type | Description |
---|---|---|---|
data | public | Partial <APIEmbed > | The initial data for the embed. |
Methods
addFields()
1addFields(...fields: RestOrArray<APIEmbedField>): this
Adds one or more fields to the embed.
Parameters
Parameter | Type | Description |
---|---|---|
…fields | RestOrArray <APIEmbedField > | The fields to add to the embed. |
Returns
this
The updated Embed instance.
Example
1embed.addFields({ name: 'Field 1', value: 'Value 1' }, { name: 'Field 2', value: 'Value 2' });
Source
seyfert/src/builders/Embed.ts:68
setAuthor()
1setAuthor(author: Object): this
Sets the author of the embed.
Parameters
Parameter | Type | Description |
---|---|---|
author | Object | The author information. |
author.iconUrl | undefined | string | - |
author.name | string | - |
author.proxyIconUrl | undefined | string | - |
author.url | undefined | string | - |
Returns
this
The updated Embed instance.
Example
1embed.setAuthor({ name: 'John Doe', iconURL: 'https://example.com/avatar.png' });
Source
seyfert/src/builders/Embed.ts:31
setColor()
1setColor(color: ColorResolvable): this
Sets the color of the embed.
Parameters
Parameter | Type | Description |
---|---|---|
color | ColorResolvable | The color of the embed. |
Returns
this
The updated Embed instance.
Example
1embed.setColor('#FF0000');2embed.setColor('Blurple');
Source
seyfert/src/builders/Embed.ts:44
setDescription()
1setDescription(desc: string): this
Sets the description of the embed.
Parameters
Parameter | Type | Description |
---|---|---|
desc | string | The description of the embed. |
Returns
this
The updated Embed instance.
Example
1embed.setDescription('This is the description of the embed');
Source
seyfert/src/builders/Embed.ts:56
setFields()
1setFields(fields: APIEmbedField[]): this
Sets the fields of the embed.
Parameters
Parameter | Type | Description |
---|---|---|
fields | APIEmbedField [] | The fields of the embed. |
Returns
this
The updated Embed instance.
Example
1embed.setFields([{ name: 'Field 1', value: 'Value 1' }, { name: 'Field 2', value: 'Value 2' }]);
Source
seyfert/src/builders/Embed.ts:80
setFooter()
1setFooter(footer: Object): this
Sets the footer of the embed.
Parameters
Parameter | Type | Description |
---|---|---|
footer | Object | The footer information. |
footer.iconUrl | undefined | string | - |
footer.text | string | - |
Returns
this
The updated Embed instance.
Example
1embed.setFooter({ text: 'This is the footer', iconURL: 'https://example.com/footer.png' });
Source
seyfert/src/builders/Embed.ts:92
setImage()
1setImage(url: string): this
Sets the image of the embed.
Parameters
Parameter | Type | Description |
---|---|---|
url | string | The URL of the image. |
Returns
this
The updated Embed instance.
Example
1embed.setImage('https://example.com/image.png');
Source
seyfert/src/builders/Embed.ts:104
setThumbnail()
1setThumbnail(url?: string): Embed
Sets the thumbnail of the embed.
Parameters
Parameter | Type | Description |
---|---|---|
url ? | string | The URL of the thumbnail. |
Returns
The updated Embed instance.
Example
1embed.setThumbnail('https://example.com/thumbnail.png');
Source
seyfert/src/builders/Embed.ts:154
setTimestamp()
1setTimestamp(time: string | number | Date): this
Sets the timestamp of the embed.
Parameters
Parameter | Type | Description |
---|---|---|
time | string | number | Date | The timestamp value. |
Returns
this
The updated Embed instance.
Example
1embed.setTimestamp();2embed.setTimestamp(1628761200000);3embed.setTimestamp(new Date());
Source
seyfert/src/builders/Embed.ts:118
setTitle()
1setTitle(title: string): this
Sets the title of the embed.
Parameters
Parameter | Type | Description |
---|---|---|
title | string | The title of the embed. |
Returns
this
The updated Embed instance.
Example
1embed.setTitle('This is the title');
Source
seyfert/src/builders/Embed.ts:130
setURL()
1setURL(url: string): this
Sets the URL of the embed.
Parameters
Parameter | Type | Description |
---|---|---|
url | string | The URL of the embed. |
Returns
this
The updated Embed instance.
Example
1embed.setURL('https://seyfert.com');
Source
seyfert/src/builders/Embed.ts:142
toJSON()
1toJSON(): APIEmbed
Converts the Embed instance to a JSON object.
Returns
APIEmbed
The JSON representation of the MessageEmbed instance.