Overview
Embed types define the structure of rich embed messages in Discord.
Embed
Alias for RawEmbed - the complete embed object type.
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
Embed title (max 256 characters)
Main embed text content (max 4096 characters)
URL that the title links to
Color bar on the left side (decimal color value)
ISO8601 timestamp shown in footer
Footer section with text and optional icon
Large image displayed at the bottom
Small image in the top-right corner
Author section displayed at the top
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] })
Footer section of an embed.
type RawEmbedFooter = {
text?: string
iconUrl?: string
}
Properties
Footer text (max 2048 characters)
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
Author name (max 256 characters)
URL when clicking the author name
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()
Image or video media in an embed.
type RawEmbedMedia = {
url?: string
}
Properties
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
Field title (max 256 characters)
Field content (max 1024 characters)
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
| Property | Limit |
|---|
| Title | 256 characters |
| Description | 4096 characters |
| Fields | 25 fields max |
| Field name | 256 characters |
| Field value | 1024 characters |
| Footer text | 2048 characters |
| Author name | 256 characters |
| Total | 6000 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