diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2022-09-06 03:29:13 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2022-09-06 03:29:13 -0400 |
commit | 90437de2c031f6cf0b58603d9cb5582064176374 (patch) | |
tree | 4eef4afe00c167d600c1e9616759cd0fe147b001 /src/discord/discord.cpp | |
parent | 654e225093db165e0c38a658103025dd7233bc71 (diff) | |
download | abaddon-portaudio-90437de2c031f6cf0b58603d9cb5582064176374.tar.gz abaddon-portaudio-90437de2c031f6cf0b58603d9cb5582064176374.zip |
make voice disconnect/reconnect work
Diffstat (limited to 'src/discord/discord.cpp')
-rw-r--r-- | src/discord/discord.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/discord/discord.cpp b/src/discord/discord.cpp index 5670d4a..f44c1ed 100644 --- a/src/discord/discord.cpp +++ b/src/discord/discord.cpp @@ -1173,12 +1173,27 @@ void DiscordClient::AcceptVerificationGate(Snowflake guild_id, VerificationGateI void DiscordClient::ConnectToVoice(Snowflake channel_id) { auto channel = GetChannel(channel_id); if (!channel.has_value() || !channel->GuildID.has_value()) return; + m_voice_channel_id = channel_id; VoiceStateUpdateMessage m; m.GuildID = *channel->GuildID; m.ChannelID = channel_id; m.PreferredRegion = "newark"; m_websocket.Send(m); } + +void DiscordClient::DisconnectFromVoice() { + m_voice.Stop(); + VoiceStateUpdateMessage m; + m_websocket.Send(m); +} + +bool DiscordClient::IsConnectedToVoice() const noexcept { + return m_voice.IsConnected(); +} + +Snowflake DiscordClient::GetVoiceChannelID() const noexcept { + return m_voice_channel_id; +} #endif void DiscordClient::SetReferringChannel(Snowflake id) { |