diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2022-10-01 17:46:10 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2022-10-01 17:46:10 -0400 |
commit | e08e3106d68da08c58f3a5bde968d4367bef78df (patch) | |
tree | c8c827d35ba2e73f305139c20d90f683ed2a24d3 /src/discord/discord.cpp | |
parent | 3e3afde2239c70404830375a0bc15878ea4c6f5d (diff) | |
download | abaddon-portaudio-e08e3106d68da08c58f3a5bde968d4367bef78df.tar.gz abaddon-portaudio-e08e3106d68da08c58f3a5bde968d4367bef78df.zip |
rudimentary dm voice call support
Diffstat (limited to 'src/discord/discord.cpp')
-rw-r--r-- | src/discord/discord.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/discord/discord.cpp b/src/discord/discord.cpp index b6bcc07..e0748fb 100644 --- a/src/discord/discord.cpp +++ b/src/discord/discord.cpp @@ -1180,10 +1180,11 @@ void DiscordClient::AcceptVerificationGate(Snowflake guild_id, VerificationGateI #ifdef WITH_VOICE void DiscordClient::ConnectToVoice(Snowflake channel_id) { auto channel = GetChannel(channel_id); - if (!channel.has_value() || !channel->GuildID.has_value()) return; + if (!channel.has_value()) return; m_voice_channel_id = channel_id; VoiceStateUpdateMessage m; - m.GuildID = *channel->GuildID; + if (channel->GuildID.has_value()) + m.GuildID = channel->GuildID; m.ChannelID = channel_id; m.PreferredRegion = "newark"; m_websocket.Send(m); @@ -2179,7 +2180,13 @@ void DiscordClient::HandleGatewayVoiceServerUpdate(const GatewayMessage &msg) { printf("token: %s\n", data.Token.c_str()); m_voice.SetEndpoint(data.Endpoint); m_voice.SetToken(data.Token); - m_voice.SetServerID(data.GuildID); + if (data.GuildID.has_value()) { + m_voice.SetServerID(*data.GuildID); + } else if (data.ChannelID.has_value()) { + m_voice.SetServerID(*data.ChannelID); + } else { + puts("no guild or channel id in voice server?"); + } m_voice.SetUserID(m_user_data.ID); m_voice.Start(); } |