From 22578921b9e577c669cd57385df48cfc08fa90eb Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Mon, 14 Dec 2020 03:05:16 -0500 Subject: pretend to be a real client a little better --- discord/store.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'discord/store.cpp') diff --git a/discord/store.cpp b/discord/store.cpp index e5dcd19..8c5b40e 100644 --- a/discord/store.cpp +++ b/discord/store.cpp @@ -69,6 +69,8 @@ void Store::SetChannel(Snowflake id, const Channel &chan) { for (const auto &u : *chan.Recipients) ids.push_back(u.ID); Bind(m_set_chan_stmt, 13, nlohmann::json(ids).dump()); + } else if (chan.RecipientIDs.has_value()) { + Bind(m_set_chan_stmt, 13, nlohmann::json(*chan.RecipientIDs).dump()); } else { Bind(m_set_chan_stmt, 13, nullptr); } @@ -297,11 +299,7 @@ std::optional Store::GetChannel(Snowflake id) const { if (!IsNull(m_get_chan_stmt, 12)) { std::string tmps; Get(m_get_chan_stmt, 12, tmps); - // dummy users - ret.Recipients = std::vector(); - auto ids = nlohmann::json::parse(tmps).get>(); - for (const auto &id : ids) - ret.Recipients->emplace_back().ID = id; + ret.RecipientIDs = nlohmann::json::parse(tmps).get>(); } Get(m_get_chan_stmt, 13, ret.Icon); Get(m_get_chan_stmt, 14, ret.OwnerID); -- cgit v1.2.3