diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2020-12-08 20:59:41 -0500 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2020-12-08 20:59:41 -0500 |
commit | bd918e760692a80988e1ba12bffa366b453567d6 (patch) | |
tree | 5e0b5a7b189185941964a5a3780e03c0ebd8d1ee /discord/store.hpp | |
parent | b84a98fbb99c1b9184ea6f12d7366028d488beb3 (diff) | |
download | abaddon-portaudio-bd918e760692a80988e1ba12bffa366b453567d6.tar.gz abaddon-portaudio-bd918e760692a80988e1ba12bffa366b453567d6.zip |
disk cache guild
Diffstat (limited to 'discord/store.hpp')
-rw-r--r-- | discord/store.hpp | 11 |
1 files changed, 6 insertions, 5 deletions
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 <unordered_map> +#include <unordered_set> #include <mutex> #include <filesystem> #include <sqlite3.h> @@ -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<Emoji> GetEmoji(Snowflake id) const; + std::optional<Guild> GetGuild(Snowflake id) const; std::optional<GuildMember> GetGuildMember(Snowflake guild_id, Snowflake user_id) const; std::optional<Message> GetMessage(Snowflake id) const; std::optional<PermissionOverwrite> GetPermissionOverwrite(Snowflake channel_id, Snowflake id) const; std::optional<Role> GetRole(Snowflake id) const; std::optional<User> 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<Snowflake, Emoji>; const channels_type &GetChannels() const; - const guilds_type &GetGuilds() const; + const std::unordered_set<Snowflake> &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<Snowflake> 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<typename T> |