forked from OpenGamers/abaddon
store READY user data into client
This commit is contained in:
@@ -51,6 +51,12 @@ const UserSettingsData &DiscordClient::GetUserSettings() const {
|
|||||||
return m_user_settings;
|
return m_user_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const UserData &DiscordClient::GetUserData() const {
|
||||||
|
std::scoped_lock<std::mutex> guard(m_mutex);
|
||||||
|
assert(m_ready_received);
|
||||||
|
return m_user_data;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::pair<Snowflake, GuildData>> DiscordClient::GetUserSortedGuilds() const {
|
std::vector<std::pair<Snowflake, GuildData>> DiscordClient::GetUserSortedGuilds() const {
|
||||||
std::vector<std::pair<Snowflake, GuildData>> sorted_guilds;
|
std::vector<std::pair<Snowflake, GuildData>> sorted_guilds;
|
||||||
|
|
||||||
@@ -283,6 +289,7 @@ void DiscordClient::HandleGatewayReady(const GatewayMessage &msg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_abaddon->DiscordNotifyReady();
|
m_abaddon->DiscordNotifyReady();
|
||||||
|
m_user_data = data.User;
|
||||||
m_user_settings = data.UserSettings;
|
m_user_settings = data.UserSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ public:
|
|||||||
using Messages_t = std::unordered_map<Snowflake, MessageData>;
|
using Messages_t = std::unordered_map<Snowflake, MessageData>;
|
||||||
|
|
||||||
const Guilds_t &GetGuilds() const;
|
const Guilds_t &GetGuilds() const;
|
||||||
|
const UserData &GetUserData() const;
|
||||||
const UserSettingsData &GetUserSettings() const;
|
const UserSettingsData &GetUserSettings() const;
|
||||||
std::vector<std::pair<Snowflake, GuildData>> GetUserSortedGuilds() const;
|
std::vector<std::pair<Snowflake, GuildData>> GetUserSortedGuilds() const;
|
||||||
std::unordered_set<const MessageData *> GetMessagesForChannel(Snowflake id) const;
|
std::unordered_set<const MessageData *> GetMessagesForChannel(Snowflake id) const;
|
||||||
@@ -110,6 +111,7 @@ private:
|
|||||||
void StoreChannel(Snowflake id, const ChannelData &c);
|
void StoreChannel(Snowflake id, const ChannelData &c);
|
||||||
Channels_t m_channels;
|
Channels_t m_channels;
|
||||||
|
|
||||||
|
UserData m_user_data;
|
||||||
UserSettingsData m_user_settings;
|
UserSettingsData m_user_settings;
|
||||||
|
|
||||||
Websocket m_websocket;
|
Websocket m_websocket;
|
||||||
|
|||||||
Reference in New Issue
Block a user