Skip to main content

Overview

Embed types define the structure of rich embed messages in Discord.

Embed

Alias for RawEmbed - the complete embed object type.
type Embed = RawEmbed

RawEmbed

Complete structure of a Discord embed.
type RawEmbed = {
  title?: string
  description?: string
  url?: string
  color?: number
  timestamp?: string
  footer?: RawEmbedFooter
  image?: RawEmbedMedia
  thumbnail?: RawEmbedMedia
  author?: RawEmbedAuthor
  fields?: RawEmbedField[]
}

Properties

title
string
Embed title (max 256 characters)
description
string
Main embed text content (max 4096 characters)
url
string
URL that the title links to
color
number
Color bar on the left side (decimal color value)
timestamp
string
ISO8601 timestamp shown in footer
Footer section with text and optional icon
image
RawEmbedMedia
Large image displayed at the bottom
thumbnail
RawEmbedMedia
Small image in the top-right corner
author
RawEmbedAuthor
Author section displayed at the top
fields
RawEmbedField[]
Array of fields (max 25)

Example

const embedObj: RawEmbed = {
  title: 'Welcome!',
  description: 'Thanks for joining our server',
  color: 0x00FF00,
  timestamp: new Date().toISOString(),
  footer: {
    text: 'Bot v1.0',
    iconUrl: 'https://example.com/icon.png'
  },
  fields: [
    { name: 'Field 1', value: 'Value 1', inline: true },
    { name: 'Field 2', value: 'Value 2', inline: true }
  ]
}

await ctx.reply({ embeds: [embedObj] })

RawEmbedFooter

Footer section of an embed.
type RawEmbedFooter = {
  text?: string
  iconUrl?: string
}

Properties

text
string
Footer text (max 2048 characters)
iconUrl
string
URL of the footer icon image

Example

const footer: RawEmbedFooter = {
  text: 'Powered by Flora',
  iconUrl: 'https://example.com/footer-icon.png'
}

const myEmbed = embed()
  .setFooter(footer.text, footer.iconUrl)
  .toJSON()

RawEmbedAuthor

Author section of an embed.
type RawEmbedAuthor = {
  name?: string
  url?: string
  iconUrl?: string
}

Properties

name
string
Author name (max 256 characters)
url
string
URL when clicking the author name
iconUrl
string
URL of the author icon image

Example

const author: RawEmbedAuthor = {
  name: 'Flora Bot',
  url: 'https://example.com',
  iconUrl: 'https://example.com/avatar.png'
}

const myEmbed = embed()
  .setAuthor(author.name, { url: author.url, iconUrl: author.iconUrl })
  .toJSON()

RawEmbedMedia

Image or video media in an embed.
type RawEmbedMedia = {
  url?: string
}

Properties

url
string
URL of the image or video

Example

const image: RawEmbedMedia = {
  url: 'https://example.com/banner.png'
}

const thumbnail: RawEmbedMedia = {
  url: 'https://example.com/thumbnail.png'
}

const myEmbed = embed()
  .setImage(image.url!)
  .setThumbnail(thumbnail.url!)
  .toJSON()

RawEmbedField

A single field in an embed.
type RawEmbedField = {
  name: string
  value: string
  inline: boolean
}

Properties

name
string
required
Field title (max 256 characters)
value
string
required
Field content (max 1024 characters)
inline
boolean
required
Whether to display inline with other fields

Example

const fields: RawEmbedField[] = [
  { name: 'Status', value: 'Online', inline: true },
  { name: 'Users', value: '1,234', inline: true },
  { name: 'Uptime', value: '99.9%', inline: true },
  { name: 'Description', value: 'A long description...', inline: false }
]

const myEmbed = embed()
  .setFields(fields)
  .toJSON()

EmbedField

Alias for RawEmbedField.
type EmbedField = RawEmbedField

Color Values

Colors are specified as decimal integers (not hex strings).

Converting Hex to Decimal

const red = 0xFF0000     // Hex: #FF0000
const green = 0x00FF00   // Hex: #00FF00
const blue = 0x0000FF    // Hex: #0000FF

// Or convert at runtime:
const color = parseInt('FF5733', 16) // 16733043

Common Colors

const Colors = {
  Red: 0xFF0000,
  Green: 0x00FF00,
  Blue: 0x0000FF,
  Yellow: 0xFFFF00,
  Purple: 0x9B59B6,
  Orange: 0xFF5733,
  Discord: 0x5865F2,
  White: 0xFFFFFF,
  Black: 0x000000
}

const myEmbed = embed()
  .setColor(Colors.Discord)
  .toJSON()

Embed Limits

PropertyLimit
Title256 characters
Description4096 characters
Fields25 fields max
Field name256 characters
Field value1024 characters
Footer text2048 characters
Author name256 characters
Total6000 characters across all text

Example with Limits

// This embed respects all limits
const validEmbed: RawEmbed = {
  title: 'A'.repeat(256),          // Max title length
  description: 'B'.repeat(4096),   // Max description length
  fields: Array(25).fill(null).map((_, i) => ({
    name: `Field ${i + 1}`,
    value: 'C'.repeat(1024),       // Max field value length
    inline: false
  })),
  footer: {
    text: 'D'.repeat(2048)         // Max footer length
  }
}

// Warning: This might exceed 6000 total characters!

Using with EmbedBuilder

The EmbedBuilder provides a fluent API for creating embeds:
const myEmbed = embed()
  .setTitle('My Title')
  .setDescription('My description')
  .setColor(0x00FF00)
  .addField('Field 1', 'Value 1', true)
  .addField('Field 2', 'Value 2', true)
  .setFooter('Footer text')
  .toJSON()

// Returns a RawEmbed object
type Result = typeof myEmbed // RawEmbed

Notes

  • All embed properties are optional except field name and value
  • Embed colors use decimal integers (e.g., 0xFF5733)
  • Timestamps must be ISO8601 format (e.g., new Date().toISOString())
  • Images and icons must be publicly accessible URLs
  • Inline fields display side-by-side (up to 3 per row)
  • Maximum 10 embeds per message
  • Empty embeds (all fields undefined) are not allowed

Build docs developers (and LLMs) love