some refactorage and add avatars to member list

This commit is contained in:
ouwou
2020-09-12 19:35:24 -04:00
parent e68f8ef8f4
commit 2822add5fe
7 changed files with 100 additions and 35 deletions

View File

@@ -1,4 +1,5 @@
#include "user.hpp"
#include "../abaddon.hpp"
bool User::HasAvatar() const {
return Avatar.size() > 0;
@@ -8,6 +9,10 @@ std::string User::GetAvatarURL(std::string ext, std::string size) const {
return "https://cdn.discordapp.com/avatars/" + std::to_string(ID) + "/" + Avatar + "." + ext + "?size=" + size;
}
Snowflake User::GetHoistedRole(Snowflake guild_id, bool with_color) const {
return Abaddon::Get().GetDiscordClient().GetMemberHoistedRole(guild_id, ID, with_color);
}
void from_json(const nlohmann::json &j, User &m) {
JS_D("id", m.ID);
JS_D("username", m.Username);