Builder for Discord embed objects.
Provides a pipe-friendly API for constructing embeds with eager validation against Discord's limits.
Example
import EDA.Embed
embed =
new()
|> title("My Embed")
|> description("A cool description")
|> color(:blurple)
|> url("https://example.com")
|> timestamp(DateTime.utc_now())
|> footer("Footer text", icon_url: "https://example.com/icon.png")
|> author("Author Name", url: "https://example.com", icon_url: "https://example.com/avatar.png")
|> thumbnail("https://example.com/thumb.png")
|> image("https://example.com/image.png")
|> field("Name", "Value")
|> field("Inline Field", "Value", inline: true)
EDA.API.Message.create(channel_id, embed: embed)
Summary
Functions
Sets the embed author.
Sets the embed color.
Sets the embed description (max 4096 characters).
Creates a red error embed with the given text as description.
Adds a field to the embed (max 25 fields).
Sets the embed footer.
Sets the embed image URL.
Creates a new empty embed.
Creates a green success embed with the given text as description.
Sets the embed thumbnail URL.
Sets the embed timestamp.
Sets the embed title (max 256 characters).
Converts the embed struct to a plain map, stripping nil values.
Sets the embed URL.
Validates the aggregate 6000-character total limit across all text content.
Like validate/1, but raises on failure.
Types
Functions
Sets the embed author.
Options
:url- URL of the author:icon_url- URL of author icon
@spec color(t(), non_neg_integer() | atom() | String.t()) :: t()
Sets the embed color.
Accepts an integer (0..0xFFFFFF), a color atom (:blurple, :red, etc.),
or a hex string ("#FF0000", "#F00", "FF0000").
Sets the embed description (max 4096 characters).
Creates a red error embed with the given text as description.
Returns a pipeable embed struct — add fields, footer, etc. as needed.
Examples
EDA.Embed.error("Something went wrong")
EDA.Embed.error("Not found") |> EDA.Embed.footer("Try again later")
Adds a field to the embed (max 25 fields).
Options
:inline- Whether the field should be inline (default:false)
Sets the embed image URL.
@spec new() :: t()
Creates a new empty embed.
Creates a green success embed with the given text as description.
Returns a pipeable embed struct — add fields, footer, etc. as needed.
Examples
EDA.Embed.success("User banned successfully")
EDA.Embed.success("Done!") |> EDA.Embed.title("Operation Complete")
Sets the embed thumbnail URL.
@spec timestamp(t(), DateTime.t() | NaiveDateTime.t() | String.t()) :: t()
Sets the embed timestamp.
Accepts a DateTime, NaiveDateTime, or an ISO 8601 string.
Sets the embed title (max 256 characters).
Converts the embed struct to a plain map, stripping nil values.
Sets the embed URL.
Validates the aggregate 6000-character total limit across all text content.
Returns {:ok, embed} or {:error, reasons}.
Like validate/1, but raises on failure.