From 6c77e89bbe18a2f03d4f00072dc3afe6b97c8866 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Mon, 2 Aug 2021 00:52:37 -0400 Subject: leave thread via menu --- discord/discord.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'discord/discord.cpp') diff --git a/discord/discord.cpp b/discord/discord.cpp index 99ffb0b..6ac2223 100644 --- a/discord/discord.cpp +++ b/discord/discord.cpp @@ -761,6 +761,17 @@ void DiscordClient::Unpin(Snowflake channel_id, Snowflake message_id, sigc::slot }); } +// i dont know if the location parameter is necessary at all but discord's thread implementation is extremely strange +// so its here just in case +void DiscordClient::LeaveThread(Snowflake channel_id, const std::string &location, sigc::slot callback) { + m_http.MakeDELETE("/channels/" + std::to_string(channel_id) + "/thread-members/@me?location=" + location, [this, callback](const http::response_type& response) { + if (CheckCode(response, 204)) + callback(DiscordError::NONE); + else + callback(GetCodeFromResponse(response)); + }); +} + void DiscordClient::FetchPinned(Snowflake id, sigc::slot, 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()) { -- cgit v1.2.3