glyde/model/embed

Message embeds, as they arrive. Every top-level field is optional: the commonest embed is a link preview with no title, description or colour.

glyde/payload/embed is the send shape, which drops what Discord ignores.

Types

pub type Embed {
  Embed(
    title: option.Option(String),
    type_: option.Option(EmbedType),
    description: option.Option(String),
    url: option.Option(String),
    timestamp: option.Option(String),
    color: option.Option(Int),
    footer: option.Option(EmbedFooter),
    image: option.Option(EmbedMedia),
    thumbnail: option.Option(EmbedMedia),
    video: option.Option(EmbedMedia),
    provider: option.Option(EmbedProvider),
    author: option.Option(EmbedAuthor),
    fields: List(EmbedField),
    flags: flags.Flags(EmbedFlag),
  )
}

Constructors

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

Constructors

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

Constructors

  • EmbedField(name: String, value: String, inline: Bool)

    name max 256, value max 1024, and 6000 characters across the embed.

pub type EmbedFlag {
  IsContentInventoryEntry
}

Constructors

  • IsContentInventoryEntry

    The embed is a content inventory entry, which a bot never sends.

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

Constructors

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

    Arguments

    text

    Max 2048 characters.

    proxy_icon_url

    Receive only.

One record for image, thumbnail and video.

pub type EmbedMedia {
  EmbedMedia(
    url: option.Option(String),
    proxy_url: option.Option(String),
    height: option.Option(Int),
    width: option.Option(Int),
    content_type: option.Option(String),
    placeholder: option.Option(String),
    placeholder_version: option.Option(Int),
    description: option.Option(String),
    flags: flags.Flags(EmbedMediaFlag),
  )
}

Constructors

pub type EmbedMediaFlag {
  IsAnimated
}

Constructors

  • IsAnimated

Its own type, not the attachment one: Discord documents a separate table for embed media, and today it names a single bit.

pub type EmbedMediaFlags =
  flags.Flags(EmbedMediaFlag)
pub type EmbedProvider {
  EmbedProvider(
    name: option.Option(String),
    url: option.Option(String),
  )
}

Constructors

Discord’s documented embed types, plus the tail for the ones it ships without documenting. Only Rich is ever sent by a bot; the rest are what the client made of a link.

pub type EmbedType {
  Rich
  Image
  Video
  Gifv
  Article
  Link
  PollResult
  AutoModerationMessage
  UnknownEmbedType(String)
}

Constructors

  • Rich
  • Image
  • Video
  • Gifv
  • Article
  • Link
  • PollResult
  • AutoModerationMessage
  • UnknownEmbedType(String)

Values

pub fn decoder() -> decode.Decoder(Embed)
pub fn embed_type_decoder() -> decode.Decoder(EmbedType)
pub fn embed_type_from_string(value: String) -> EmbedType
pub fn embed_type_to_string(value: EmbedType) -> String
pub fn has_flag(
  bits: flags.Flags(EmbedFlag),
  flag: EmbedFlag,
) -> Bool
pub fn has_media_flag(
  bits: flags.Flags(EmbedMediaFlag),
  flag: EmbedMediaFlag,
) -> Bool
Search Document