From 2a45d7173ab58e60b63ce1e1183d719442988a32 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Fri, 20 Aug 2021 01:13:51 -0400 Subject: proper member list in threads --- discord/objects.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'discord/objects.cpp') diff --git a/discord/objects.cpp b/discord/objects.cpp index fb713f4..725cba5 100644 --- a/discord/objects.cpp +++ b/discord/objects.cpp @@ -85,11 +85,16 @@ void to_json(nlohmann::json &j, const LazyLoadRequestMessage &m) { for (const auto &[key, chans] : *m.Channels) j["d"]["channels"][std::to_string(key)] = chans; } - j["d"]["typing"] = m.ShouldGetTyping; - j["d"]["activities"] = m.ShouldGetActivities; - j["d"]["threads"] = m.ShouldGetThreads; + if (m.ShouldGetTyping) + j["d"]["typing"] = *m.ShouldGetTyping; + if (m.ShouldGetActivities) + j["d"]["activities"] = *m.ShouldGetActivities; + if (m.ShouldGetThreads) + j["d"]["threads"] = *m.ShouldGetThreads; if (m.Members.has_value()) j["d"]["members"] = *m.Members; + if (m.ThreadIDs.has_value()) + j["d"]["thread_member_lists"] = *m.ThreadIDs; } void to_json(nlohmann::json &j, const UpdateStatusMessage &m) { @@ -511,3 +516,14 @@ void from_json(const nlohmann::json &j, ThreadMemberUpdateData &m) { void from_json(const nlohmann::json &j, ThreadUpdateData &m) { m.Thread = j; } + +void from_json(const nlohmann::json &j, ThreadMemberListUpdateData::UserEntry &m) { + JS_D("user_id", m.UserID); + JS_D("member", m.Member); +} + +void from_json(const nlohmann::json &j, ThreadMemberListUpdateData &m) { + JS_D("thread_id", m.ThreadID); + JS_D("guild_id", m.GuildID); + JS_D("members", m.Members); +} -- cgit v1.2.3