EmbedBuilder is a builder pattern for creating ApiEmbed. The result is passed to MessagePayload::add_embed or MessagePayload::add_embed_builder.
Limits
| Field | Maximum |
|---|---|
title | 256 characters |
description | 4096 characters |
fields | 25 items |
field.name | 256 characters |
field.value | 1024 characters |
footer.text | 2048 characters |
author.name | 256 characters |
| Total (all text fields combined) | 6000 characters |
Creating
EmbedBuilder::new
EmbedBuilder::from_embed
ApiEmbed. Use to edit an already-built embed.
Methods
title
description
url
title a clickable link. Not displayed if title is not set.
color
0x5865F2.
color_hex
"#5865F2" and "5865F2" formats. If the string is invalid, the color is not changed.
color_rgb
timestamp
"2024-01-15T12:00:00Z").
Example: current time as timestamp
Example: current time as timestamp
author
| Parameter | Description |
|---|---|
name | Author name. Truncated to 256 characters. |
url | Link when clicking the author name. |
icon_url | URL of the author icon (displayed to the left of the name). |
footer
text is truncated to 2048 characters.
image
thumbnail
video
audio
field
| Parameter | Description |
|---|---|
name | Field heading. Truncated to 256 characters. |
value | Field content. Supports Markdown. Truncated to 1024 characters. |
inline | If true, fields are displayed side by side (up to 3 per row). |
Once the 25-field limit is reached, new fields are silently ignored - no panic.
build
ApiEmbed. Panics if the total length of all text fields exceeds 6000 characters.
ApiEmbed
The resulting structure from thefluxer_types crate.
| Field | Type | Description |
|---|---|---|
kind | Option<String> | Embed type. Always "rich" for bots. |
title | Option<String> | Title. |
description | Option<String> | Main text. |
url | Option<String> | Title URL. |
color | Option<u32> | Accent color (RGB integer). |
timestamp | Option<String> | Timestamp (ISO 8601). |
author | Option<ApiEmbedAuthor> | Author block. |
footer | Option<ApiEmbedFooter> | Footer row. |
image | Option<ApiEmbedMedia> | Large image. |
thumbnail | Option<ApiEmbedMedia> | Thumbnail. |
video | Option<ApiEmbedMedia> | Video. |
audio | Option<ApiEmbedMedia> | Audio. |
fields | Option<Vec<ApiEmbedField>> | List of fields. None if no fields were added. |
Examples
Minimal embed
Minimal embed
Full embed with fields, author, and footer
Full embed with fields, author, and footer
Embed with an image
Embed with an image
Multiple embeds in one message
Multiple embeds in one message
Edit an existing embed
Edit an existing embed
