diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-06-20 20:32:16 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-06-20 20:32:16 -0400 |
commit | 7db2675087a563ec82574937759137fa2e57298c (patch) | |
tree | dc1dac731ef1ca4f4f89edb2913e34abc2eaeda9 /discord/discord.cpp | |
parent | 78f3164063f90c2be53d56fef6fd4a1cd085d923 (diff) | |
download | abaddon-portaudio-7db2675087a563ec82574937759137fa2e57298c.tar.gz abaddon-portaudio-7db2675087a563ec82574937759137fa2e57298c.zip |
fetch pins from store if already requested
Diffstat (limited to 'discord/discord.cpp')
-rw-r--r-- | discord/discord.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/discord/discord.cpp b/discord/discord.cpp index ab5ab9f..89107df 100644 --- a/discord/discord.cpp +++ b/discord/discord.cpp @@ -720,6 +720,13 @@ void DiscordClient::Unpin(Snowflake channel_id, Snowflake message_id, sigc::slot } void DiscordClient::FetchPinned(Snowflake id, sigc::slot<void(std::vector<Message>, DiscordError code)> callback) { + // return from db if we know the pins have already been requested + if (m_channels_pinned_requested.find(id) != m_channels_pinned_requested.end()) { + callback(m_store.GetPinnedMessages(id), DiscordError::NONE); + return; + } + m_channels_pinned_requested.insert(id); + m_http.MakeGET("/channels/" + std::to_string(id) + "/pins", [this, callback](const http::response_type &response) { if (!CheckCode(response)) { callback({}, GetCodeFromResponse(response)); |