Remedy.CDN (Remedy v0.6.8) 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.
Unless specified, discord will deliver the smallest size available. ( Potato )
Link to this section Summary
Types
A four digit integer assigned by discord to avoid duplicate usernames
The images hash.
The images size.
The snowflake id of the resource.
Functions
Returns an achievement icon url.
Returns an application asset url.
Returns an application cover url.
Returns the url for the applications icon.
Returns the url for a custom emoji.
Returns the url for the default avatar of a user.
Returns the url for a guilds banner.
Returns the url for a guilds discovery splash.
Returns the url for a guilds icon.
Returns the url for a guilds splash.
Returns a sticker banner url.
Returns the url for the users avatar.
Returns the url for a users banner.
Link to this section Types
Specs
discriminator() :: integer()
A four digit integer assigned by discord to avoid duplicate usernames
Specs
hash() :: binary()
The images hash.
Specs
size() :: integer() | nil
The images size.
Specs
snowflake() :: Sunbake.Snowflake.t()
The snowflake id of the resource.
Specs
uri() :: String.t()
Link to this section Functions
achievement_icon(application_id, achievement_id, icon_hash, size \\ nil)
View SourceSpecs
Returns an achievement icon url.
Specs
Returns an application asset url.
Specs
Returns an application cover url.
Specs
Returns the url for the applications icon.
Specs
Returns the url for a custom emoji.
Specs
default_user_avatar(discriminator(), size()) :: uri()
Returns the url for the default avatar of a user.
That is, their avatar if they do not have one set, based on their discriminator. It can also take just the discriminator if you wish to do so.
Examples
iex> Remedy.CDN.default_user_avatar(3)
"https://cdn.discordapp.com/embed/avatars/3.png"
Specs
Returns the url for a guilds banner.
guild_discovery_splash(guild_id, guild_discovery_splash, size \\ nil)
View SourceSpecs
Returns the url for a guilds discovery splash.
Specs
Returns the url for a guilds icon.
Examples
iex> Remedy.CDN.guild_icon(872417560094732328, "f817c5adaf96672c94a17de8e944f427")
"https://cdn.discordapp.com/icons/872417560094732328/f817c5adaf96672c94a17de8e944f427.png"
Specs
Returns the url for a guilds splash.
Examples
iex> Remedy.CDN.guild_splash(848619361782726696, "7ed6ea26b7a5e64f78ca5df202cf4d13")
"https://cdn.discordapp.com/splashes/848619361782726696/7ed6ea26b7a5e64f78ca5df202cf4d13.png"
Specs
Returns a sticker banner url.
Specs
Returns the url for the users avatar.
Examples
iex> Remedy.CDN.user_avatar(707047919332884520, "1df05ae0f21a24c377e9a1051c2b6035", 128)
"https://cdn.discordapp.com/avatars/707047919332884520/1df05ae0f21a24c377e9a1051c2b6035.png?size=128"
Specs
Returns the url for a users banner.
Examples
iex> Remedy.CDN.user_banner(179255727561375744, "e625e858e48602248a69bcfdfa886ab4")
"https://cdn.discordapp.com/banners/179255727561375744/e625e858e48602248a69bcfdfa886ab4.png"