Skip to main content

default_avatar_index

Function default_avatar_index 

Source
pub const fn default_avatar_index(user_id: UserId, discriminator: u16) -> u8
Expand description

The index of the default avatar of a user without one: (user_id >> 22) % 6 for users on the new username system (discriminator 0), discriminator % 5 for the others.

discord.js counterpart: the index User#defaultAvatarURL uses.

ยงExamples

use djs_model::id::UserId;
use djs_rest::cdn::default_avatar_index;

assert_eq!(default_avatar_index(UserId::new(80_351_110_224_678_912), 1337), 2);
assert_eq!(default_avatar_index(UserId::new(80_351_110_224_678_912), 0), 5);