glyde/model/emoji

Two records. Emoji is the partial a button, a select option and a reaction carry; GuildEmoji is that plus the fields only a guild’s own emoji has.

Types

What every emoji payload carries, full or partial.

pub type Emoji {
  Emoji(kind: Kind, animated: Bool)
}

Constructors

  • Emoji(kind: Kind, animated: Bool)

A guild’s own emoji, from Guild.emojis and GUILD_EMOJIS_UPDATE. Nothing below emoji is ever sent on a component or a reaction.

pub type GuildEmoji {
  GuildEmoji(
    emoji: Emoji,
    roles: List(id.Id(id.Role)),
    uploader: option.Option(user.User),
    require_colons: Bool,
    managed: Bool,
    available: Bool,
  )
}

Constructors

  • GuildEmoji(
      emoji: Emoji,
      roles: List(id.Id(id.Role)),
      uploader: option.Option(user.User),
      require_colons: Bool,
      managed: Bool,
      available: Bool,
    )

    Arguments

    roles

    The roles allowed to use it.

    uploader

    Who uploaded it. Needs the MANAGE_GUILD_EXPRESSIONS permission.

    available

    False when the guild lost the boosts that paid for it.

The id and the name move together. A unicode emoji is its name and has no id; a custom one is its id and may have lost its name. Discord never sends neither, which is the state this collapse removes.

pub type Kind {
  Unicode(name: String)
  Custom(id: id.Id(id.Emoji), name: option.Option(String))
}

Constructors

  • Unicode(name: String)
  • Custom(id: id.Id(id.Emoji), name: option.Option(String))

    name is null in reactions, for a custom emoji deleted since.

Values

pub fn custom(id: id.Id(id.Emoji), name: String) -> Emoji

The partial that reactions and components take. For an animated one: Emoji(..custom(id, name), animated: True).

pub fn decoder() -> decode.Decoder(Emoji)
pub fn guild_emoji_decoder() -> decode.Decoder(GuildEmoji)

The guild fields sit beside the partial’s, not nested under a key.

pub fn to_json(emoji: Emoji) -> json.Json

The partial Discord accepts in a component or a reaction. A null id is how it tells a unicode emoji from a custom one, so the key is always there.

pub fn unicode(name: String) -> Emoji

A standard emoji, named by the character itself.

Search Document