From bd918e760692a80988e1ba12bffa366b453567d6 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Tue, 8 Dec 2020 20:59:41 -0500 Subject: disk cache guild --- discord/store.hpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'discord/store.hpp') diff --git a/discord/store.hpp b/discord/store.hpp index 437cae9..6d1987f 100644 --- a/discord/store.hpp +++ b/discord/store.hpp @@ -2,6 +2,7 @@ #include "../util.hpp" #include "objects.hpp" #include +#include #include #include #include @@ -29,15 +30,14 @@ public: // slap const on everything even tho its not *really* const Channel *GetChannel(Snowflake id); - Guild *GetGuild(Snowflake id); std::optional GetEmoji(Snowflake id) const; + std::optional GetGuild(Snowflake id) const; std::optional GetGuildMember(Snowflake guild_id, Snowflake user_id) const; std::optional GetMessage(Snowflake id) const; std::optional GetPermissionOverwrite(Snowflake channel_id, Snowflake id) const; std::optional GetRole(Snowflake id) const; std::optional GetUser(Snowflake id) const; const Channel *GetChannel(Snowflake id) const; - const Guild *GetGuild(Snowflake id) const; void ClearGuild(Snowflake id); void ClearChannel(Snowflake id); @@ -52,7 +52,7 @@ public: using emojis_type = std::unordered_map; const channels_type &GetChannels() const; - const guilds_type &GetGuilds() const; + const std::unordered_set &GetGuilds() const; void ClearAll(); @@ -61,8 +61,7 @@ public: private: channels_type m_channels; - guilds_type m_guilds; - members_type m_members; + std::unordered_set m_guilds; bool CreateTables(); bool CreateStatements(); @@ -101,6 +100,8 @@ private: mutable sqlite3_stmt *m_get_emote_stmt; mutable sqlite3_stmt *m_set_member_stmt; mutable sqlite3_stmt *m_get_member_stmt; + mutable sqlite3_stmt *m_set_guild_stmt; + mutable sqlite3_stmt *m_get_guild_stmt; }; template -- cgit v1.2.3