fix some PRESENCE_UPDATE bugs

This commit is contained in:
ouwou 2020-10-13 23:52:56 -04:00
parent 99597a80d2
commit 00770e4bcb
3 changed files with 4 additions and 3 deletions

View File

@ -606,6 +606,7 @@ void DiscordClient::HandleGatewayGuildMemberUpdate(const GatewayMessage &msg) {
void DiscordClient::HandleGatewayPresenceUpdate(const GatewayMessage &msg) {
PresenceUpdateMessage data = msg.Data;
auto cur = m_store.GetUser(data.User.at("id").get<Snowflake>());
if (cur != nullptr)
User::update_from_json(data.User, *cur);
}

View File

@ -150,7 +150,7 @@ void from_json(const nlohmann::json &j, ClientStatus &m) {
void from_json(const nlohmann::json &j, PresenceUpdateMessage &m) {
m.User = j.at("user");
JS_D("guild_id", m.GuildID);
JS_O("guild_id", m.GuildID);
JS_D("status", m.Status);
// JS_D("activities", m.Activities);
JS_D("client_status", m.ClientStatus);

View File

@ -213,7 +213,7 @@ struct ClientStatus {
struct PresenceUpdateMessage {
nlohmann::json User; // the client updates an existing object from this data
Snowflake GuildID;
Snowflake GuildID; // opt
std::string Status;
// std::vector<Activity> Activities;
ClientStatus ClientStatus;