summaryrefslogtreecommitdiff
path: root/src/discord/discord.cpp
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2024-06-30 20:39:11 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2024-06-30 20:39:11 -0400
commit3109089e8c557c1385d3e6a34d9a097f905cec00 (patch)
tree801c2f46bb4f3200db7c10cdda9b784565671727 /src/discord/discord.cpp
parent7f709ce89cea9540b623b97df0a50a7cefc1f823 (diff)
downloadabaddon-portaudio-3109089e8c557c1385d3e6a34d9a097f905cec00.tar.gz
abaddon-portaudio-3109089e8c557c1385d3e6a34d9a097f905cec00.zip
accept/decline stage invite
Diffstat (limited to 'src/discord/discord.cpp')
-rw-r--r--src/discord/discord.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/discord/discord.cpp b/src/discord/discord.cpp
index d99e57a..a7712d6 100644
--- a/src/discord/discord.cpp
+++ b/src/discord/discord.cpp
@@ -1355,6 +1355,23 @@ void DiscordClient::SetStageSpeaking(Snowflake channel_id, bool want, const sigc
});
}
+void DiscordClient::DeclineInviteToSpeak(Snowflake channel_id, const sigc::slot<void(DiscordError code)> &callback) {
+ const auto channel = GetChannel(channel_id);
+ if (!channel.has_value() || !channel->GuildID.has_value()) return;
+
+ ModifyCurrentUserVoiceStateObject d;
+ d.ChannelID = channel_id;
+ d.Suppress = true;
+ d.RequestToSpeakTimestamp = "";
+ m_http.MakePATCH("/guilds/" + std::to_string(*channel->GuildID) + "/voice-states/@me", nlohmann::json(d).dump(), [callback](const http::response_type &response) {
+ if (CheckCode(response, 204)) {
+ callback(DiscordError::NONE);
+ } else {
+ callback(GetCodeFromResponse(response));
+ }
+ });
+}
+
DiscordVoiceClient &DiscordClient::GetVoiceClient() {
return m_voice;
}