EDA.API.Emoji (EDA v0.5.0-beta.2)

Copy Markdown View Source

REST API endpoints for Discord guild emojis.

All functions return {:ok, result} or {:error, reason}.

Summary

Functions

Creates a guild emoji.

Creates an application emoji.

Deletes a guild emoji.

Deletes an application emoji.

Gets a guild emoji by ID. Returns an EDA.Emoji struct.

Gets one of the application's emojis.

Lists all emojis for a guild. Returns EDA.Emoji structs.

Lists the application's emojis. Returns EDA.Emoji structs.

Modifies a guild emoji.

Renames an application emoji — the only thing that can change about one.

Functions

create(guild_id, params)

@spec create(String.t() | integer(), map()) :: {:ok, EDA.Emoji.t()} | {:error, term()}

Creates a guild emoji.

Parameters

  • guild_id - The guild ID
  • params - Map with:
    • :name - Emoji name (required)
    • :image - Base64-encoded image data URI (required)
    • :roles - List of role IDs allowed to use this emoji (optional)

create_application(name, image)

@spec create_application(String.t(), String.t() | binary()) ::
  {:ok, EDA.Emoji.t()} | {:error, term()}

Creates an application emoji.

image is a path, raw PNG/JPEG/GIF bytes or a data URI — see EDA.ImageData. Discord takes a 128×128 image of at most 256 KiB, and refuses a larger one with a bare 400.

delete(guild_id, emoji_id)

@spec delete(String.t() | integer(), String.t() | integer()) :: :ok | {:error, term()}

Deletes a guild emoji.

delete_application(emoji_id)

@spec delete_application(String.t() | integer()) :: :ok | {:error, term()}

Deletes an application emoji.

get(guild_id, emoji_id)

@spec get(String.t() | integer(), String.t() | integer()) ::
  {:ok, EDA.Emoji.t()} | {:error, term()}

Gets a guild emoji by ID. Returns an EDA.Emoji struct.

get_application(emoji_id)

@spec get_application(String.t() | integer()) ::
  {:ok, EDA.Emoji.t()} | {:error, term()}

Gets one of the application's emojis.

list(guild_id)

@spec list(String.t() | integer()) :: {:ok, [EDA.Emoji.t()]} | {:error, term()}

Lists all emojis for a guild. Returns EDA.Emoji structs.

list_application()

@spec list_application() :: {:ok, [EDA.Emoji.t()]} | {:error, term()}

Lists the application's emojis. Returns EDA.Emoji structs.

modify(guild_id, emoji_id, params)

@spec modify(String.t() | integer(), String.t() | integer(), map()) ::
  {:ok, EDA.Emoji.t()} | {:error, term()}

Modifies a guild emoji.

modify_application(emoji_id, name)

@spec modify_application(String.t() | integer(), String.t()) ::
  {:ok, EDA.Emoji.t()} | {:error, term()}

Renames an application emoji — the only thing that can change about one.