diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-11-28 22:48:30 -0500 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-11-28 22:48:30 -0500 |
commit | e1703aea3fd597b23bde90e6c505278c517be611 (patch) | |
tree | 37d98fc90c9cd0844388bfb79beda2204f44af92 /discord/user.hpp | |
parent | fd53a76bf6f53a095a639765923a30f2206b2cd6 (diff) | |
parent | e02107feea8214a045e6faa969f00dcbc0d2b072 (diff) | |
download | abaddon-portaudio-e1703aea3fd597b23bde90e6c505278c517be611.tar.gz abaddon-portaudio-e1703aea3fd597b23bde90e6c505278c517be611.zip |
merge master
Diffstat (limited to 'discord/user.hpp')
-rw-r--r-- | discord/user.hpp | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/discord/user.hpp b/discord/user.hpp deleted file mode 100644 index d4711fa..0000000 --- a/discord/user.hpp +++ /dev/null @@ -1,82 +0,0 @@ -#pragma once -#include "snowflake.hpp" -#include "json.hpp" -#include <string> - -enum class EPremiumType { - None = 0, - NitroClassic = 1, - Nitro = 2, -}; - -struct UserData { - enum { - DiscordEmployee = 1 << 0, - PartneredServerOwner = 1 << 1, - HypeSquadEvents = 1 << 2, - BugHunterLevel1 = 1 << 3, - HouseBravery = 1 << 6, - HouseBrilliance = 1 << 7, - HouseBalance = 1 << 8, - EarlySupporter = 1 << 9, - TeamUser = 1 << 10, // no idea what this is - System = 1 << 12, - BugHunterLevel2 = 1 << 14, - VerifiedBot = 1 << 16, - EarlyVerifiedBotDeveloper = 1 << 17, - CertifiedModerator = 1 << 18, - - MaxFlag_PlusOne, - MaxFlag = MaxFlag_PlusOne - 1, - }; - - static const char *GetFlagName(uint64_t flag); - static const char *GetFlagReadableName(uint64_t flag); - - Snowflake ID; - std::string Username; - std::string Discriminator; - std::string Avatar; // null - std::optional<bool> IsBot; - std::optional<bool> IsSystem; - std::optional<bool> IsMFAEnabled; - std::optional<std::string> Locale; - std::optional<bool> IsVerified; - std::optional<std::string> Email; // null - std::optional<uint64_t> Flags; - std::optional<EPremiumType> PremiumType; // null - std::optional<uint64_t> PublicFlags; - - // undocumented (opt) - std::optional<bool> IsDesktop; - std::optional<bool> IsMobile; - std::optional<bool> IsNSFWAllowed; // null - std::optional<std::string> Phone; // null? - // for now (unserialized) - std::optional<std::string> BannerHash; // null - std::optional<std::string> Bio; // null - - friend void from_json(const nlohmann::json &j, UserData &m); - friend void to_json(nlohmann::json &j, const UserData &m); - void update_from_json(const nlohmann::json &j); - - bool IsDeleted() const; - bool HasAvatar() const; - bool HasAnimatedAvatar() const; - std::string GetAvatarURL(Snowflake guild_id, std::string ext = "png", std::string size = "32") const; - std::string GetAvatarURL(const std::optional<Snowflake> &guild_id, std::string ext = "png", std::string size = "32") const; - std::string GetAvatarURL(std::string ext = "png", std::string size = "32") const; - std::string GetDefaultAvatarURL() const; - Snowflake GetHoistedRole(Snowflake guild_id, bool with_color = false) const; - std::string GetMention() const; - std::string GetEscapedName() const; - std::string GetEscapedBoldName() const; - std::string GetEscapedString() const; - template<bool with_at> - inline std::string GetEscapedBoldString() const { - if constexpr (with_at) - return "<b>@" + Glib::Markup::escape_text(Username) + "</b>#" + Discriminator; - else - return "<b>" + Glib::Markup::escape_text(Username) + "</b>#" + Discriminator; - } -}; |