concord 2.5.9

A terminal user interface client for Discord
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::fmt;

const CUSTOM_EMOJI_CDN_BASE: &str = "https://cdn.discordapp.com/emojis";

/// Builds the CDN URL Discord documents for a custom emoji.
///
/// Animated emoji may originate as WebP or AVIF and Discord does not convert
/// those uploads to GIF. Requesting animated WebP works for every supported
/// source format and matches the format used by Discord's own client.
pub(crate) fn custom_emoji_image_url(id: impl fmt::Display, animated: bool) -> String {
    if animated {
        format!("{CUSTOM_EMOJI_CDN_BASE}/{id}.webp?animated=true")
    } else {
        format!("{CUSTOM_EMOJI_CDN_BASE}/{id}.png")
    }
}