Class: MessageEmbed

MessageEmbed

Represents an embed in a message (image/video preview, rich embed, etc.)

Constructor

new MessageEmbed()

Source:

Members

(nullable) author :MessageEmbedAuthor

The author of this embed (if there is one)
Type:
Source:

(nullable) color :number

The color of this embed
Type:
  • number
Source:

(readonly, nullable) createdAt :Date

The date displayed on this embed
Type:
  • Date
Source:

(nullable) description :string

The description of this embed
Type:
  • string
Source:

fields :Array.<EmbedField>

The fields of this embed
Type:
Source:

files :Array.<(FileOptions|string|MessageAttachment)>

The files of this embed
Type:
Source:
The footer of this embed
Type:
Source:

(readonly, nullable) hexColor :string

The hexadecimal version of the embed color, with a leading hash
Type:
  • string
Source:

(nullable) image :MessageEmbedImage

The image of this embed, if there is one
Type:
Source:

(readonly) length :number

The accumulated length for the embed title, description, fields and footer text
Type:
  • number
Source:

(nullable) provider :MessageEmbedProvider

The provider of this embed (if there is one)
Type:
Source:

(nullable) thumbnail :MessageEmbedThumbnail

The thumbnail of this embed (if there is one)
Type:
Source:

(nullable) timestamp :number

The timestamp of this embed
Type:
  • number
Source:

(nullable) title :string

The title of this embed
Type:
  • string
Source:

type :string

The type of this embed, either: * `rich` - a rich embed * `image` - an image embed * `video` - a video embed * `gifv` - a gifv embed * `article` - an article embed * `link` - a link embed
Type:
  • string
Source:

(nullable) url :string

The URL of this embed
Type:
  • string
Source:

(readonly, nullable) video :MessageEmbedVideo

The video of this embed (if there is one)
Type:
Source:

Methods

(static) normalizeField(name, value, inlineopt) → {EmbedField}

Normalizes field input and resolves strings.
Parameters:
Name Type Attributes Default Description
name StringResolvable The name of the field
value StringResolvable The value of the field
inline boolean <optional>
false Set the field to display inline
Source:
Returns:
Type
EmbedField

(static) normalizeFields(…fields) → {Array.<EmbedField>}

Normalizes field input and resolves strings.
Parameters:
Name Type Attributes Description
fields EmbedFieldData | Array.<EmbedFieldData> <repeatable>
Fields to normalize
Source:
Returns:
Type
Array.<EmbedField>

addField(name, value, inlineopt) → {MessageEmbed}

Adds a field to the embed (max 25).
Parameters:
Name Type Attributes Default Description
name StringResolvable The name of this field
value StringResolvable The value of this field
inline boolean <optional>
false If this field will be displayed inline
Source:
Returns:
Type
MessageEmbed

addFields(…fields) → {MessageEmbed}

Adds fields to the embed (max 25).
Parameters:
Name Type Attributes Description
fields EmbedFieldData | Array.<EmbedFieldData> <repeatable>
The fields to add
Source:
Returns:
Type
MessageEmbed

attachFiles(files) → {MessageEmbed}

Sets the file to upload alongside the embed. This file can be accessed via `attachment://fileName.extension` when setting an embed image or author/footer icons. Multiple files can be attached.
Parameters:
Name Type Description
files Array.<(FileOptions|string|MessageAttachment)> Files to attach
Source:
Returns:
Type
MessageEmbed

setAuthor(name, iconURLopt, urlopt) → {MessageEmbed}

Sets the author of this embed.
Parameters:
Name Type Attributes Description
name StringResolvable The name of the author
iconURL string <optional>
The icon URL of the author
url string <optional>
The URL of the author
Source:
Returns:
Type
MessageEmbed

setColor(color) → {MessageEmbed}

Sets the color of this embed.
Parameters:
Name Type Description
color ColorResolvable The color of the embed
Source:
Returns:
Type
MessageEmbed

setDescription(description) → {MessageEmbed}

Sets the description of this embed.
Parameters:
Name Type Description
description StringResolvable The description
Source:
Returns:
Type
MessageEmbed

setFooter(text, iconURLopt) → {MessageEmbed}

Sets the footer of this embed.
Parameters:
Name Type Attributes Description
text StringResolvable The text of the footer
iconURL string <optional>
The icon URL of the footer
Source:
Returns:
Type
MessageEmbed

setImage(url) → {MessageEmbed}

Sets the image of this embed.
Parameters:
Name Type Description
url string The URL of the image
Source:
Returns:
Type
MessageEmbed

setThumbnail(url) → {MessageEmbed}

Sets the thumbnail of this embed.
Parameters:
Name Type Description
url string The URL of the thumbnail
Source:
Returns:
Type
MessageEmbed

setTimestamp(timestampopt) → {MessageEmbed}

Sets the timestamp of this embed.
Parameters:
Name Type Attributes Default Description
timestamp Date | number <optional>
Date.now() The timestamp or date
Source:
Returns:
Type
MessageEmbed

setTitle(title) → {MessageEmbed}

Sets the title of this embed.
Parameters:
Name Type Description
title StringResolvable The title
Source:
Returns:
Type
MessageEmbed

setURL(url) → {MessageEmbed}

Sets the URL of this embed.
Parameters:
Name Type Description
url string The URL
Source:
Returns:
Type
MessageEmbed

spliceFields(index, deleteCount, …fieldsopt) → {MessageEmbed}

Removes, replaces, and inserts fields in the embed (max 25).
Parameters:
Name Type Attributes Description
index number The index to start at
deleteCount number The number of fields to remove
fields EmbedFieldData | Array.<EmbedFieldData> <optional>
<repeatable>
The replacing field objects
Source:
Returns:
Type
MessageEmbed

toJSON() → {Object}

Transforms the embed to a plain object.
Source:
Returns:
The raw data of this embed
Type
Object