Update default avatar generation
This commit is contained in:
parent
24512469e9
commit
6f0a4d1316
1 changed files with 8 additions and 3 deletions
|
@ -92,11 +92,16 @@ impl User {
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
// Archived user or user with no avatar, calculate default avatar
|
// 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!(
|
None => format!(
|
||||||
"https://cdn.discordapp.com/embed/avatars/{}.png",
|
"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
|
||||||
|
}
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue