glyph/builders/embed

This contains the builder functions for constructing an Embed

Example

embed.new()
|> embed.title("Example embed")
|> embed.description("Example description")

Types

These are the colors of the official Discord palette

pub type EmbedColor {
  White
  Greyple
  Black
  DarkButNotBlack
  NotQuiteBlack
  Blurple
  Green
  Yellow
  Fuschia
  Red
}

Constructors

  • White
  • Greyple
  • Black
  • DarkButNotBlack
  • NotQuiteBlack
  • Blurple
  • Green
  • Yellow
  • Fuschia
  • Red

Functions

pub fn author(e: Embed, name: String) -> Embed

Set a name for an author

pub fn author_icon(e: Embed, icon_url: String) -> Embed

Set an icon URL for an author

pub fn author_url(e: Embed, url: String) -> Embed

Set a URL for an author

pub fn color(e: Embed, color: EmbedColor) -> Embed

Set the embed color to one of the available options

pub fn description(e: Embed, description: String) -> Embed

Set the description of the embed

pub fn field(
  e: Embed,
  name: String,
  value: String,
  inline: Bool,
) -> Embed

Add a new field to the embed

pub fn footer_icon_url(e: Embed, icon_url: String) -> Embed

Set an icon URL for the embed’s footer

pub fn footer_text(e: Embed, text: String) -> Embed

Set the text for the embed’s footer

pub fn image(e: Embed, image_url: String) -> Embed

Set the source URL for an image

pub fn image_height(e: Embed, height: Int) -> Embed

Set the height of the embedded image

pub fn image_width(e: Embed, width: Int) -> Embed

Set the width of the embedded image

pub fn new() -> Embed

Construct a new, empty Embed

pub fn provider(
  e: Embed,
  name: Option(String),
  url: Option(String),
) -> Embed

Set a name and URL for a provider (e.g. Twitch and https://twitch.tv)

pub fn thumbnail(e: Embed, thumbnail_url: String) -> Embed

Set the source URL for a thumbnail

pub fn thumbnail_height(e: Embed, height: Int) -> Embed

Set the height of the thumbnail image

pub fn thumbnail_width(e: Embed, width: Int) -> Embed

Set the width of the thumbnail image

pub fn title(e: Embed, title: String) -> Embed

Set the title of the embed

pub fn url(e: Embed, url: String) -> Embed

Set the source URL of the embed

pub fn video(e: Embed, video_url: String) -> Embed

Set the source URL for a video

pub fn video_height(e: Embed, height: Int) -> Embed

Set the height of the embedded video

pub fn video_width(e: Embed, width: Int) -> Embed

Set the width of the embedded video

Search Document