From 1251d89ef0577c9d450a8581d52dd94b67a45075 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Wed, 7 Apr 2021 20:42:53 -0400 Subject: use discord's default avatars instead of placeholder --- discord/user.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'discord/user.cpp') diff --git a/discord/user.cpp b/discord/user.cpp index 0ecf725..144de38 100644 --- a/discord/user.cpp +++ b/discord/user.cpp @@ -14,7 +14,10 @@ bool UserData::HasAnimatedAvatar() const { } std::string UserData::GetAvatarURL(std::string ext, std::string size) const { - return "https://cdn.discordapp.com/avatars/" + std::to_string(ID) + "/" + Avatar + "." + ext + "?size=" + size; + if (HasAvatar()) + return "https://cdn.discordapp.com/avatars/" + std::to_string(ID) + "/" + Avatar + "." + ext + "?size=" + size; + else + return "https://cdn.discordapp.com/embed/avatars/" + std::to_string(std::stoul(Discriminator) % 5) + ".png"; // size isn't respected by the cdn } Snowflake UserData::GetHoistedRole(Snowflake guild_id, bool with_color) const { -- cgit v1.2.3