diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2020-09-10 18:28:42 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2020-09-10 18:28:42 -0400 |
commit | 54a8244bfdd26656260b3c82391db2213f937ac7 (patch) | |
tree | 2b782882fb61ac039129d8fc7d8a18e3459c2092 /discord | |
parent | 2c5ce3866ccf53381282f44e023416b26041dcd3 (diff) | |
download | abaddon-portaudio-54a8244bfdd26656260b3c82391db2213f937ac7.tar.gz abaddon-portaudio-54a8244bfdd26656260b3c82391db2213f937ac7.zip |
basic avatars
Diffstat (limited to 'discord')
-rw-r--r-- | discord/user.cpp | 8 | ||||
-rw-r--r-- | discord/user.hpp | 3 |
2 files changed, 11 insertions, 0 deletions
diff --git a/discord/user.cpp b/discord/user.cpp index a4c4424..cfc9e34 100644 --- a/discord/user.cpp +++ b/discord/user.cpp @@ -1,5 +1,13 @@ #include "user.hpp" +bool User::HasAvatar() const { + return Avatar.size() > 0; +} + +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; +} + void from_json(const nlohmann::json &j, User &m) { JS_D("id", m.ID); JS_D("username", m.Username); diff --git a/discord/user.hpp b/discord/user.hpp index 1a6beaa..e495b21 100644 --- a/discord/user.hpp +++ b/discord/user.hpp @@ -25,4 +25,7 @@ struct User { std::string Phone; // null? friend void from_json(const nlohmann::json &j, User &m); + + bool HasAvatar() const; + std::string GetAvatarURL(std::string ext = "png", std::string size = "64") const; }; |