diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-11-24 20:31:34 -0500 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-11-24 20:31:34 -0500 |
commit | 069c22e9cd37158fa50e3fac67d4d6938d173554 (patch) | |
tree | a6237bcf5f068d4c5f752cd8c5f46a343823c834 /src/discord/discord.cpp | |
parent | 8f30bb33a3d79a7207809b35d4a39751e4d53123 (diff) | |
download | abaddon-portaudio-069c22e9cd37158fa50e3fac67d4d6938d173554.tar.gz abaddon-portaudio-069c22e9cd37158fa50e3fac67d4d6938d173554.zip |
add fetching private archived threads
Diffstat (limited to 'src/discord/discord.cpp')
-rw-r--r-- | src/discord/discord.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/discord/discord.cpp b/src/discord/discord.cpp index f920099..a90fc50 100644 --- a/src/discord/discord.cpp +++ b/src/discord/discord.cpp @@ -292,6 +292,19 @@ void DiscordClient::GetArchivedPublicThreads(Snowflake channel_id, sigc::slot<vo }); } +void DiscordClient::GetArchivedPrivateThreads(Snowflake channel_id, sigc::slot<void(DiscordError, const ArchivedThreadsResponseData &)> callback) { + m_http.MakeGET("/channels/" + std::to_string(channel_id) + "/users/@me/threads/archived/private", [this, callback](const http::response_type &r) { + if (CheckCode(r)) { + const auto data = nlohmann::json::parse(r.text).get<ArchivedThreadsResponseData>(); + for (const auto &thread : data.Threads) + m_store.SetChannel(thread.ID, thread); + callback(DiscordError::NONE, data); + } else { + callback(GetCodeFromResponse(r), {}); + } + }); +} + bool DiscordClient::IsThreadJoined(Snowflake thread_id) const { return std::find(m_joined_threads.begin(), m_joined_threads.end(), thread_id) != m_joined_threads.end(); } |