pins: separate msgs, sort and store

This commit is contained in:
ouwou
2021-06-15 01:01:29 -04:00
parent e166c83d33
commit d527669d39
4 changed files with 12 additions and 1 deletions

View File

@@ -718,6 +718,9 @@ void DiscordClient::FetchPinned(Snowflake id, sigc::slot<void(std::vector<Messag
}
auto data = nlohmann::json::parse(response.text).get<std::vector<Message>>();
std::sort(data.begin(), data.end(), [](const Message &a, const Message &b) { return a.ID < b.ID; });
for (auto &msg : data)
StoreMessageData(msg);
callback(std::move(data), DiscordError::NONE);
});
}