Remedy.CDN (Remedy v0.6.3) View Source

Discord CDN interface.

Storing images and other assets can be painful, use this module to retreive assets from the discord cdn rather than storing them.

Each function takes the required parameters to directly access a resource.

Format

All images are returned as either a .png or a .gif if the asset is animated. This is done automatically.

Size

Images can be requested of a size in [16, 32, 64, 128, 256, 512, 1024, 2048, 4096]. This is given as an optional final argument to any of the functions in this module. Arguments given will be rounded to the next largest, or the largest size if you try to go over.

Missing Endpoints:

  • sticker
  • team icon
  • role icon
  • guild member icon

Link to this section Summary

Link to this section Types

Specs

discriminator() :: integer()

Specs

hash() :: binary()

Specs

size() :: integer() | nil

Specs

snowflake() :: Snowflake.t()

Link to this section Functions

Link to this function

application_cover(application, size \\ nil)

View Source

Specs

application_cover(Remedy.Schema.App.t(), size()) :: binary()
Link to this function

application_icon(application, size \\ nil)

View Source

Specs

application_icon(Remedy.Schema.App.t(), size()) :: binary()
Link to this function

custom_emoji(id, size \\ nil)

View Source
Link to this function

guild_banner(guild, size \\ nil)

View Source

Specs

guild_banner(Remedy.Schema.Guild.t(), size()) :: binary()
Link to this function

guild_discovery_splash(guild, size \\ nil)

View Source

Specs

guild_discovery_splash(Remedy.Schema.Guild.t(), size()) :: binary()
Link to this function

guild_icon(guild, size \\ nil)

View Source

Specs

guild_icon(Remedy.Schema.Guild.t(), size()) :: binary()

Returns the url for the guilds icon.

Examples

iex> Remedy.API.get_guild!(872417560094732328) |> Remedy.CDN.guild_icon()
"https://cdn.discordapp.com/icons/872417560094732328/f817c5adaf96672c94a17de8e944f427.jpg?size=128"


iex> Remedy.API.get_guild!(872417560094732328) |> Remedy.CDN.guild_icon(100)
"https://cdn.discordapp.com/icons/872417560094732328/f817c5adaf96672c94a17de8e944f427.jpg?size=128"


iex> Remedy.CDN.guild_icon(872417560094732328, "f817c5adaf96672c94a17de8e944f427", "cheese")
"https://cdn.discordapp.com/icons/872417560094732328/f817c5adaf96672c94a17de8e944f427.jpg"
Link to this function

guild_splash(guild, size \\ nil)

View Source

Specs

guild_splash(Remedy.Schema.Guild.t(), size()) :: binary()
Link to this function

user_avatar(user, size \\ nil)

View Source

Specs

user_avatar(Remedy.Schema.User.t(), size()) :: binary()
Link to this function

user_banner(user, size \\ nil)

View Source

Specs

user_banner(Remedy.Schema.User.t(), size()) :: binary()