diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-08-11 03:32:09 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-08-11 03:32:09 -0400 |
commit | 7ffded5b1373444cf3442d759a3bd8ae0940bd7d (patch) | |
tree | 575e6cfb5c610aa5d5271083cd769728df1885e9 /discord/discord.cpp | |
parent | e01110c7393d5071ea271f1978b3a2ece59415ad (diff) | |
download | abaddon-portaudio-7ffded5b1373444cf3442d759a3bd8ae0940bd7d.tar.gz abaddon-portaudio-7ffded5b1373444cf3442d759a3bd8ae0940bd7d.zip |
rest of view threads window
Diffstat (limited to 'discord/discord.cpp')
-rw-r--r-- | discord/discord.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/discord/discord.cpp b/discord/discord.cpp index aa363f5..7dfacc0 100644 --- a/discord/discord.cpp +++ b/discord/discord.cpp @@ -249,8 +249,22 @@ std::set<Snowflake> DiscordClient::GetChannelsInGuild(Snowflake id) const { return {}; } -std::vector<ChannelData> DiscordClient::GetPublicThreads(Snowflake channel_id) const { - return m_store.GetThreads(channel_id); +// there is an endpoint for this but it should be synced before this is called anyways +std::vector<ChannelData> DiscordClient::GetActiveThreads(Snowflake channel_id) const { + return m_store.GetActiveThreads(channel_id); +} + +void DiscordClient::GetArchivedPublicThreads(Snowflake channel_id, sigc::slot<void(DiscordError, const ArchivedThreadsResponseData &)> callback) { + m_http.MakeGET("/channels/" + std::to_string(channel_id) + "/threads/archived/public", [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 { |