view user profile (notes+connections+badges)

change some stuff with callbacks
This commit is contained in:
ouwou
2021-02-04 23:41:53 -05:00
parent 0479bf52c2
commit 64adcffe42
40 changed files with 686 additions and 37 deletions

View File

@@ -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<std::string> Members; // snowflake?
std::unordered_map<Snowflake, std::vector<std::pair<int, int>>> Channels; // channel ID -> range of sidebar
std::optional<std::vector<std::string>> Members; // snowflake?
std::optional<std::unordered_map<Snowflake, std::vector<std::pair<int, int>>>> 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<std::string> Nick; // null
friend void from_json(const nlohmann::json &j, MutualGuildData &m);
};
struct UserProfileData {
std::vector<ConnectionData> ConnectedAccounts;
std::vector<MutualGuildData> MutualGuilds;
std::optional<std::string> PremiumGuildSince; // null
std::optional<std::string> 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<std::string> Note;
std::optional<Snowflake> NoteUserID;
std::optional<Snowflake> 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);
};