module Discord::CDN
Overview
This module contains methods for building URLs to resources on Discord's CDN for things like guild icons and avatars.
NOTE All size
arguments for CDN methods must be a power of 2 between 16
and 2048. If an invalid size is given, ArgumentError
will be raised.
API Documentation for image formatting
Extended Modules
Defined in:
discordcr/cdn.crConstant Summary
-
BASE_URL =
"https://cdn.discordapp.com"
-
Base CDN URL
Instance Method Summary
-
#application_asset(application_id : UInt64 | Snowflake, asset_id : UInt64 | Snowflake, format : ApplicationAssetFormat = ApplicationAssetFormat::PNG, size : Int32 = 128)
Produces a CDN URL for an application asset in the given
format
andsize
-
#application_icon(id : UInt64 | Snowflake, icon : String, format : ApplicationIconFormat = ApplicationIconFormat::WebP, size : Int32 = 128)
Produces a CDN URL for an application icon in the given
format
andsize
-
#custom_emoji(id : UInt64 | Snowflake, format : CustomEmojiFormat = CustomEmojiFormat::PNG, size : Int32 = 128)
Produces a CDN URL for a custom emoji in the given
format
andsize
-
#default_user_avatar(user_discriminator : String)
Produces a CDN URL for a default user avatar, calculated from the given discriminator value.
-
#guild_icon(id : UInt64 | Snowflake, icon : String, format : GuildIconFormat = GuildIconFormat::WebP, size : Int32 = 128)
Produces a CDN URL for a guild icon in the given
format
andsize
-
#guild_splash(id : UInt64 | Snowflake, splash : String, format : GuildSplashFormat = GuildSplashFormat::WebP, size : Int32 = 128)
Produces a CDN URL for a guild splash in the given
format
andsize
-
#user_avatar(id : UInt64 | Snowflake, avatar : String, size : Int32 = 128)
Produces a CDN URL for a user avatar in the given
size
. -
#user_avatar(id : UInt64 | Snowflake, avatar : String, format : UserAvatarFormat, size : Int32 = 128)
Produces a CDN URL for a user avatar in the given
format
andsize
Instance Method Detail
Produces a CDN URL for an application asset in the given format
and size
Produces a CDN URL for an application icon in the given format
and size
Produces a CDN URL for a custom emoji in the given format
and size
Produces a CDN URL for a default user avatar, calculated from the given discriminator value.
Produces a CDN URL for a guild icon in the given format
and size
Produces a CDN URL for a guild splash in the given format
and size
Produces a CDN URL for a user avatar in the given size
. Given the avatar
string, this will return a WebP or GIF based on the animated avatar hint.
Produces a CDN URL for a user avatar in the given format
and size