From efc97aa2b0d7a4d63a2e6219070919559a0cf64d Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Thu, 10 Jun 2021 15:27:32 -0400 Subject: reduce db access + refactor --- discord/discord.hpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'discord/discord.hpp') diff --git a/discord/discord.hpp b/discord/discord.hpp index 029cc71..a3f72ba 100644 --- a/discord/discord.hpp +++ b/discord/discord.hpp @@ -68,13 +68,14 @@ public: const UserData &GetUserData() const; const UserSettings &GetUserSettings() const; std::vector GetUserSortedGuilds() const; - std::set GetMessagesForChannel(Snowflake id) const; + std::vector GetMessagesForChannel(Snowflake id, size_t limit = 50) const; + std::vector GetMessageIDsForChannel(Snowflake id) const; std::set GetPrivateChannels() const; EPremiumType GetSelfPremiumType() const; - void FetchMessagesInChannel(Snowflake id, std::function &)> cb); - void FetchMessagesInChannelBefore(Snowflake channel_id, Snowflake before_id, std::function &)> cb); + void FetchMessagesInChannel(Snowflake id, sigc::slot &)> cb); + void FetchMessagesInChannelBefore(Snowflake channel_id, Snowflake before_id, sigc::slot &)> cb); std::optional GetMessage(Snowflake id) const; std::optional GetChannel(Snowflake id) const; std::optional GetEmoji(Snowflake id) const; @@ -247,9 +248,6 @@ private: std::string m_token; - void AddMessageToChannel(Snowflake msg_id, Snowflake channel_id); - std::unordered_map> m_chan_to_message_map; - void AddUserToGuild(Snowflake user_id, Snowflake guild_id); std::unordered_map> m_guild_to_users; -- cgit v1.2.3