From 64adcffe4272d109f296ff46fbc52eea5cf367bd Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Thu, 4 Feb 2021 23:41:53 -0500 Subject: view user profile (notes+connections+badges) change some stuff with callbacks --- discord/objects.hpp | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) (limited to 'discord/objects.hpp') diff --git a/discord/objects.hpp b/discord/objects.hpp index 0b3e92d..4974131 100644 --- a/discord/objects.hpp +++ b/discord/objects.hpp @@ -61,6 +61,7 @@ enum class GatewayEvent : int { GUILD_BAN_ADD, INVITE_CREATE, INVITE_DELETE, + USER_NOTE_UPDATE, }; enum class GatewayCloseCode : uint16_t { @@ -170,8 +171,8 @@ struct LazyLoadRequestMessage { Snowflake GuildID; bool ShouldGetTyping = false; bool ShouldGetActivities = false; - std::vector Members; // snowflake? - std::unordered_map>> Channels; // channel ID -> range of sidebar + std::optional> Members; // snowflake? + std::optional>>> Channels; // channel ID -> range of sidebar friend void to_json(nlohmann::json &j, const LazyLoadRequestMessage &m); }; @@ -424,3 +425,51 @@ struct InviteDeleteObject { friend void from_json(const nlohmann::json &j, InviteDeleteObject &m); }; + +struct ConnectionData { + std::string ID; + std::string Type; + std::string Name; + bool IsVerified; + + friend void from_json(const nlohmann::json &j, ConnectionData &m); +}; + +struct MutualGuildData { + Snowflake ID; + std::optional Nick; // null + + friend void from_json(const nlohmann::json &j, MutualGuildData &m); +}; + +struct UserProfileData { + std::vector ConnectedAccounts; + std::vector MutualGuilds; + std::optional PremiumGuildSince; // null + std::optional PremiumSince; // null + UserData User; + + friend void from_json(const nlohmann::json &j, UserProfileData &m); +}; + +struct UserNoteObject { + // idk if these can be null or missing but i play it safe + std::optional Note; + std::optional NoteUserID; + std::optional UserID; + + friend void from_json(const nlohmann::json &j, UserNoteObject &m); +}; + +struct UserSetNoteObject { + std::string Note; + + friend void to_json(nlohmann::json &j, UserSetNoteObject &m); +}; + +struct UserNoteUpdateMessage { + std::string Note; + Snowflake ID; + + friend void from_json(const nlohmann::json &j, UserNoteUpdateMessage &m); +}; -- cgit v1.2.3