Update default avatar generation

This commit is contained in:
Elnu 2025-03-27 12:15:03 -07:00
parent 24512469e9
commit 6f0a4d1316

View file

@ -92,11 +92,16 @@ impl User {
}
),
// Archived user or user with no avatar, calculate default avatar
// https://www.reddit.com/r/discordapp/comments/au6v4e/comment/eh61dm6/
// https://docs.rs/serenity/0.11.5/serenity/model/user/struct.User.html#method.default_avatar_url
None => format!(
"https://cdn.discordapp.com/embed/avatars/{}.png",
self.discriminator % 5
// https://docs.rs/serenity/0.12.4/src/serenity/model/user.rs.html#805
if self.discriminator == 0 {
// New avatar system
((self.id >> 22) % 6) as u16
} else {
// Old avatar system
self.discriminator % 5
}
),
}
}