kitazith/embed

Types

Learn more: Message Resource - Documentation - Discord > Embed Object

Total number of characters limitation

Up to 6000 characters total across all title, description, field.name, field.value, footer.text, and author.name fields in all embeds per message.

Source: Message Resource - Documentation - Discord > Embed Object > Embed Limits

Limited fields are available

type, provider, and video fields are not supported for the webhook embed objects.

Source: Webhook Resource - Documentation - Discord > Execute Webhook

pub type Embed {
  Embed(
    title: option.Option(String),
    description: option.Option(String),
    url: option.Option(String),
    timestamp: option.Option(timestamp.Timestamp),
    color: option.Option(Int),
    footer: option.Option(EmbedFooter),
    image: option.Option(EmbedImage),
    thumbnail: option.Option(EmbedThumbnail),
    author: option.Option(EmbedAuthor),
    fields: option.Option(List(EmbedField)),
  )
}

Constructors

pub type EmbedAuthor {
  EmbedAuthor(
    name: String,
    url: option.Option(String),
    icon_url: option.Option(String),
  )
}

Constructors

  • EmbedAuthor(
      name: String,
      url: option.Option(String),
      icon_url: option.Option(String),
    )

    Arguments

    name

    At least 1 character and up to 256 characters.

pub type EmbedField {
  EmbedField(
    name: String,
    value: String,
    inline: option.Option(Bool),
  )
}

Constructors

  • EmbedField(
      name: String,
      value: String,
      inline: option.Option(Bool),
    )

    Arguments

    name

    At least 1 character and up to 256 characters.

    value

    At least 1 character and up to 1024 characters.

pub type EmbedFooter {
  EmbedFooter(text: String, icon_url: option.Option(String))
}

Constructors

  • EmbedFooter(text: String, icon_url: option.Option(String))

    Arguments

    text

    At least 1 character and up to 2048 characters.

pub type EmbedImage {
  EmbedImage(url: String)
}

Constructors

  • EmbedImage(url: String)
pub type EmbedThumbnail {
  EmbedThumbnail(url: String)
}

Constructors

  • EmbedThumbnail(url: String)

Values

pub fn new() -> Embed
pub fn new_author(name: String) -> EmbedAuthor
pub fn new_field(
  name name: String,
  value value: String,
) -> EmbedField
pub fn new_footer(text: String) -> EmbedFooter
pub fn to_json(embed: Embed) -> json.Json
pub fn with_author(embed: Embed, author: EmbedAuthor) -> Embed
pub fn with_author_icon_url(
  author: EmbedAuthor,
  icon_url: String,
) -> EmbedAuthor
pub fn with_author_url(
  author: EmbedAuthor,
  url: String,
) -> EmbedAuthor
pub fn with_color(embed: Embed, color: Int) -> Embed
pub fn with_description(
  embed: Embed,
  description: String,
) -> Embed
pub fn with_field_inline(
  field: EmbedField,
  inline: Bool,
) -> EmbedField
pub fn with_fields(
  embed: Embed,
  fields: List(EmbedField),
) -> Embed
pub fn with_footer(embed: Embed, footer: EmbedFooter) -> Embed
pub fn with_footer_icon_url(
  footer: EmbedFooter,
  icon_url: String,
) -> EmbedFooter
pub fn with_image(embed: Embed, image: EmbedImage) -> Embed
pub fn with_thumbnail(
  embed: Embed,
  thumbnail: EmbedThumbnail,
) -> Embed
pub fn with_timestamp(
  embed: Embed,
  timestamp: timestamp.Timestamp,
) -> Embed
pub fn with_title(embed: Embed, title: String) -> Embed
pub fn with_url(embed: Embed, url: String) -> Embed
Search Document