module

Discord::CDN

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

Constants

BASE_URL = "https://cdn.discordapp.com"

Base CDN URL

Instance methods

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 and size

Source
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 and size

Source
custom_emoji(id : UInt64 | Snowflake, format : CustomEmojiFormat = CustomEmojiFormat::PNG, size : Int32 = 128)

Produces a CDN URL for a custom emoji in the given format and size

Source
default_user_avatar(user_discriminator : String)

Produces a CDN URL for a default user avatar, calculated from the given discriminator value.

Source
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 and size

Source
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 and size

Source
user_avatar(id : UInt64 | Snowflake, avatar : String, size : Int32 = 128)

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.

Source
user_avatar(id : UInt64 | Snowflake, avatar : String, format : UserAvatarFormat, size : Int32 = 128)

Produces a CDN URL for a user avatar in the given format and size

Source

Nested types