Embeds are rich content blocks that display formatted information in Discord. Flora provides a builder API for creating embeds.
Basic Usage
const myEmbed = embed()
.setTitle('Status')
.setDescription('All systems nominal')
.setColor(0x00ff00)
.toJSON()
await ctx.reply({ embeds: [myEmbed] })
Embed Builder
The embed() function returns an EmbedBuilder with chainable methods:
Title and Description
const infoEmbed = embed()
.setTitle('Server Information')
.setDescription('Details about this server')
.toJSON()
Color
Set the accent color (left border):
embed().setColor(0x3366ff) // Hex color
embed().setColor(3368703) // Integer color
Common Colors
Discord Brand
0x00ff00 // Green
0xff0000 // Red
0x0099ff // Blue
0xffaa00 // Orange
0x9900ff // Purple
0x5865F2 // Discord Blurple
0x57F287 // Discord Green
0xED4245 // Discord Red
URL
Make the title clickable:
embed()
.setTitle('Documentation')
.setUrl('https://flora.dev/docs')
Timestamp
Add a timestamp footer:
embed().setTimestamp(new Date().toISOString())
Fields
Add structured data with fields:
const statsEmbed = embed()
.setTitle('Server Stats')
.addField('Members', '1,234', true)
.addField('Online', '567', true)
.addField('Channels', '42', true)
.toJSON()
Inline Fields
The third parameter controls inline layout:
embed()
.addField('Field 1', 'Value 1', true) // Inline
.addField('Field 2', 'Value 2', true) // Inline (same row)
.addField('Field 3', 'Value 3', false) // Full width
Up to 3 inline fields can fit per row. Discord automatically wraps to new rows.
Multiple Fields
Add multiple fields at once:
embed().addFields([
{ name: 'CPU', value: '45%', inline: true },
{ name: 'Memory', value: '2.1 GB', inline: true },
{ name: 'Uptime', value: '5 days', inline: true }
])
Replace Fields
const builder = embed()
.addField('Old', 'Data')
builder.setFields([
{ name: 'New', value: 'Data' }
])
Images and Thumbnails
Main Image
Large image at the bottom:
embed().setImage('https://example.com/banner.png')
Thumbnail
Small image in the top-right:
embed().setThumbnail('https://example.com/icon.png')
Full Example
const userEmbed = embed()
.setTitle('User Profile')
.setThumbnail('https://cdn.discord.com/avatars/123/abc.png')
.addField('Username', 'Alice#1234')
.addField('Joined', '2 years ago')
.setImage('https://example.com/banner.png')
.setColor(0x3366ff)
.toJSON()
Add footer text and optional icon:
embed().setFooter('Flora Bot', 'https://example.com/logo.png')
embed().setFooter('Page 1 of 5') // Icon optional
Author
Add author information at the top:
embed().setAuthor('Alice', {
url: 'https://example.com/alice',
iconUrl: 'https://example.com/alice.png'
})
embed().setAuthor('System') // Minimal usage
Complete Example
const statusEmbed = embed()
.setTitle('Bot Status')
.setDescription('All systems operational')
.setColor(0x00ff00)
.setThumbnail('https://example.com/icon.png')
.addField('Uptime', '99.9%', true)
.addField('Latency', '42ms', true)
.addField('Version', '1.0.0', true)
.setFooter('Flora Runtime')
.setTimestamp(new Date().toISOString())
.toJSON()
await ctx.reply({ embeds: [statusEmbed] })
Multiple Embeds
Send up to 10 embeds in one message:
const embed1 = embed().setTitle('First').setColor(0xff0000).toJSON()
const embed2 = embed().setTitle('Second').setColor(0x00ff00).toJSON()
const embed3 = embed().setTitle('Third').setColor(0x0000ff).toJSON()
await ctx.reply({
embeds: [embed1, embed2, embed3]
})
Reusing Embeds
You can initialize an embed with existing data:
const template = {
title: 'Template',
color: 0x3366ff,
footer: { text: 'Flora' }
}
const customEmbed = embed(template)
.setDescription('Custom description')
.toJSON()
Type Definitions
export class EmbedBuilder {
setTitle(title: string): this
setDescription(description: string): this
setUrl(url: string): this
setColor(color: number): this
setTimestamp(timestamp: string): this
setFooter(text: string, iconUrl?: string): this
setImage(url: string): this
setThumbnail(url: string): this
setAuthor(name?: string, options?: { url?: string; iconUrl?: string }): this
addField(name: string, value: string, inline?: boolean): this
addFields(fields: EmbedField[]): this
setFields(fields: EmbedField[]): this
toJSON(): Embed
}
export type EmbedField = {
name: string
value: string
inline?: boolean
}
export function embed(initial?: Embed): EmbedBuilder
Limits
Maximum description length
Maximum number of fields per embed
Maximum field name length
Maximum field value length
Maximum footer text length
Maximum author name length
Sum of all text fields in the embed
Best Practices
Use colors meaningfully
Green for success, red for errors, blue for information.
Keep descriptions concise
Long text is hard to read. Use fields for structured data.
Add timestamps for time-sensitive info
Helps users understand when data was generated.
Use inline fields for stats
Makes data more scannable and visually appealing.