Skip to content

Embed

Represents embeds.


Properties



Title

An optional string that contains the embed's title.




Description

An optional string that contains the embed's description.




Url

An optional string that contains the embed's url.




Timestamp

An optional Datetime instance representing the embed's timestamp.




Color

An optional Color3 instance representing the embed's color.




An optional EmbedFooter instance representing the embed's footer.




Image

An optional EmbedImage instance representing the embed's image.




Thumbnail

An optional EmbedThumbnail instance representing the embed's Thumbnail.

Info

The following properties: Height, Width and ProxyUrl are only returned if the embed object was returned by Discord.




Author

An optional EmbedAuthor instance representing the embed's author.




Fields

A table of EmbedField instances representing the embed's fields.




Constructors



This method returns a new Embed instance.

Parameters

  • title : string? - Sets the title of the embed during initialisation.
  • description : string? - Sets the description of the embed during initialisation.
  • url : string? - Sets the url attached to the embed's title during initialisation.
  • timestamp : Datetime? - Sets the embed's timestamp during initialisation.
  • color : Color3? - Sets the embed's color during initialisation.
  • footer : EmbedFooter? - Sets the embed's footer during initialisation.
  • image : EmbedImage? - Sets the embed's image during initialisation.
  • thumbnail : EmbedThumbnail? - Sets the embed's thumbnail during initialisation.
  • author : EmbedAuthor? - Sets the embed's author during initialisation.
  • fields : { EmbedField }? - Sets the embed's fields during initialisation.




Methods



SetTitle(title)

This method sets the embed's title. Returns self to allow chaining.

Parameters

  • title : string - The title of the embed.




SetDescription(description)

This method sets the embed's description. Returns self to allow chaining.

Parameters

  • description : string - The description of the embed.




SetUrl(url)

This method sets the embed's url. Returns self to allow chaining.

Info

If the embed title is absent, this makes no changes.

Parameters

  • url : string - The url of the title hyperlink.




SetTimestamp(customTimestamp)

This method sets the embed's timestamp. Returns self to allow chaining.

Default Parameter Values

customTimestamp: Datetime.now()

Parameters

  • customTimestamp : Datetime? - Sets the embed's timestamp to a datetime of your choosing.




SetColor(color3)

This method sets the embed's color code. Returns self to allow chaining.

Parameters

  • color3 : Color3 - The embed's new color.




SetFooter(text, iconUrl)

This method sets the embed's footer. Returns self to allow chaining.

Info

Only urls that use the HTTPS protocol are allowed to be used for the iconUrl parameter.

Parameters

  • text : string - The footer's text.
  • iconUrl : string? - The footer's url.




SetImage(url)

This method sets the embed's image. Returns self to allow chaining.

Info

Only urls that use the HTTPS protocol are allowed to be used for the url parameter.

Parameters

  • url : string - The image's url.




SetThumbnail(url)

This method sets the embed's thumbnail. Returns self to allow chaining.

Info

Only urls that use the HTTPS protocol are allowed to be used for the url parameter.

Parameters

  • url : string - The thumbnail's url.




SetAuthor(name, url, iconUrl)

This method sets the embed's author. Returns self to allow chaining.

Info

Only urls that use the HTTPS protocol are allowed to be used for the iconUrl parameter.

Parameters

  • name : string - The author's name.
  • url : string? - The author's url.
  • iconUrl : string? - The author's icon url.




AddField(name, value, inLine)

Appends a field to the embed. Returns self to allow chaining.

Default Parameter Values

inLine: true

Parameters

  • name : string - The field's name.
  • value : string - The field's value.
  • inLine : boolean? - Whether the field should display inline.




SetFieldAt(index, name, value, inLine)

Modifies a field belonging to the embed. Returns self to allow chaining.

Parameters

  • index : string - The index of the field to modify.
  • name : string - The field's name.
  • value : string - The field's value.
  • inLine : boolean? - Whether the field should display inline.




RemoveFieldAt(index)

Removes the field at the specified index. Returns self to allow chaining.

Parameters

  • index : string - The index of the field to remove.




RemoveAllFields()

Removes every field belonging to the embed. Returns self to allow chaining.




TotalCharacters()

Returns a number representing the total amount of characters in the embed.




_Validate()

Validates the embed to avoid making a bad request to Discord. This method returns a tuple containing 2 items a boolean and an optional string.

Internal Code warning

This method is not meant to be used outside of Voyager's internal code.

Info

The boolean value indicates whether the validation was successful, and the optional string contains the error message if validation failed.