Make sure a presence update payload is valid
This commit is contained in:
parent
2ff89d9e18
commit
611ac34389
|
@ -410,6 +410,7 @@ proc messageReactionRemoveEmoji(shard: Shard, json: JsonNode) =
|
||||||
proc presenceUpdate(shard: Shard, json: JsonNode) =
|
proc presenceUpdate(shard: Shard, json: JsonNode) =
|
||||||
# This proc doesn't actually dispatch any events,
|
# This proc doesn't actually dispatch any events,
|
||||||
# it just updates member.presence
|
# it just updates member.presence
|
||||||
|
if json.contains("guild_id"): # Make sure that json contains a guild_id
|
||||||
var g = shard.client.cache.getGuild(getIDFromJson(json["guild_id"].getStr()))
|
var g = shard.client.cache.getGuild(getIDFromJson(json["guild_id"].getStr()))
|
||||||
var member = g.getGuildMember(getIDFromJson(json["user"]["id"].getStr()))
|
var member = g.getGuildMember(getIDFromJson(json["user"]["id"].getStr()))
|
||||||
|
|
||||||
|
|
Reference in New Issue