discljord.cdn

Namespace with functions to create [cdn urls](https://discord.com/developers/docs/reference#image-formatting) to image data from API entities such as users or guilds.

animated?

(animated? hash)
Takes an image data hash and returns whether it represents an animated image (gif) or not.

application-icon

Takes an OAuth2 application info object and returns a url to its icon.

The current application info is obtainable via [[discljord.messaging/get-current-application-information!]].

base-url

custom-emoji

(custom-emoji emoji)
Takes a custom emoji object or id and returns a url to the image data.

Note that an id alone is not enough to determine whether the emoji is animated or not,
so if you pass an id you will always get a url to a png.

default-user-avatar

(default-user-avatar user-or-discrim)
Takes a user object or a discriminator and returns a url to the default avatar image of that user/discriminator.

effective-user-avatar

(effective-user-avatar user)
Takes a user object and returns a url to the effective avatar of that user.

I.e., if the user has a custom avatar, it returns that, otherwise it returns the default avatar for that user.

file-name

(file-name hash)
Takes an image data hash and returns the file name it represents with the correct extension.

guild-banner

Takes a guild and returns a url to the guild's banner or `nil` if the guild does not have a banner.

guild-discovery-splash

Takes a guild and returns a url to the guild's discovery splash or `nil` if the guild does not have a discovery splash.

guild-icon

Takes a guild and returns a url to the guild's icon or `nil` if the guild does not have an icon.

guild-splash

Takes a guild and returns a url to the guild's splash or `nil` if the guild does not have a splash.

image-url-generator

(image-url-generator path hash-key)
Returns a function that, given an object with an id and an image data hash, returns a url to that image.

resize

(resize url size)
Adds a size query parameter to the given image url, resulting in a resize of the image.

Any power of 2 between 16 and 4096 is a valid size.

user-avatar

Takes a user object and returns a url to the avatar of that user or `nil` if the user does not have an avatar.