rewrite DiscordVoiceClient and stuff

This commit is contained in:
ouwou
2023-01-03 19:01:33 -05:00
parent 6ff2563e36
commit 4740965f4c
7 changed files with 228 additions and 224 deletions

View File

@@ -1194,10 +1194,14 @@ void DiscordClient::DisconnectFromVoice() {
m_websocket.Send(m);
}
bool DiscordClient::IsConnectedToVoice() const noexcept {
bool DiscordClient::IsVoiceConnected() const noexcept {
return m_voice.IsConnected();
}
bool DiscordClient::IsVoiceConnecting() const noexcept {
return m_voice.IsConnecting();
}
Snowflake DiscordClient::GetVoiceChannelID() const noexcept {
return m_voice_channel_id;
}
@@ -2174,7 +2178,7 @@ void DiscordClient::HandleGatewayVoiceStateUpdate(const GatewayMessage &msg) {
m_voice.SetSessionID(data.SessionID);
// channel_id = null means disconnect. stop cuz out of order maybe
if (!data.ChannelID.has_value()) {
if (!data.ChannelID.has_value() && (m_voice.IsConnected() || m_voice.IsConnecting())) {
m_voice.Stop();
}
} else {