summaryrefslogtreecommitdiff
path: root/src/discord/objects.cpp
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2022-09-06 03:29:13 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2022-09-06 03:29:13 -0400
commit90437de2c031f6cf0b58603d9cb5582064176374 (patch)
tree4eef4afe00c167d600c1e9616759cd0fe147b001 /src/discord/objects.cpp
parent654e225093db165e0c38a658103025dd7233bc71 (diff)
downloadabaddon-portaudio-90437de2c031f6cf0b58603d9cb5582064176374.tar.gz
abaddon-portaudio-90437de2c031f6cf0b58603d9cb5582064176374.zip
make voice disconnect/reconnect work
Diffstat (limited to 'src/discord/objects.cpp')
-rw-r--r--src/discord/objects.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/discord/objects.cpp b/src/discord/objects.cpp
index a6a7cc6..3cdc6b5 100644
--- a/src/discord/objects.cpp
+++ b/src/discord/objects.cpp
@@ -644,8 +644,14 @@ void from_json(const nlohmann::json &j, GuildMembersChunkData &m) {
#ifdef WITH_VOICE
void to_json(nlohmann::json &j, const VoiceStateUpdateMessage &m) {
j["op"] = GatewayOp::VoiceStateUpdate;
- j["d"]["guild_id"] = m.GuildID;
- j["d"]["channel_id"] = m.ChannelID;
+ if (m.GuildID.has_value())
+ j["d"]["guild_id"] = *m.GuildID;
+ else
+ j["d"]["guild_id"] = nullptr;
+ if (m.ChannelID.has_value())
+ j["d"]["channel_id"] = *m.ChannelID;
+ else
+ j["d"]["channel_id"] = nullptr;
j["d"]["self_mute"] = m.SelfMute;
j["d"]["self_deaf"] = m.SelfDeaf;
j["d"]["self_video"] = m.SelfVideo;