summaryrefslogtreecommitdiff
path: root/discord/discord.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'discord/discord.cpp')
-rw-r--r--discord/discord.cpp7
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));