Fix some emoji json parsing issues

This commit is contained in:
SeanOMik 2020-06-22 16:57:16 -05:00
parent e3c561a690
commit 3b99b5bd23
No known key found for this signature in database
GPG Key ID: FA4D55AC05268A88
1 changed files with 2 additions and 1 deletions

View File

@ -15,11 +15,12 @@ proc newEmoji*(json: JsonNode, guild: snowflake): Emoji =
## Construct an emoji with json. ## Construct an emoji with json.
## This shouldn't really be used by the user, only internal use. ## This shouldn't really be used by the user, only internal use.
result = Emoji( result = Emoji(
id: getIDFromJson(json["id"].getStr()),
name: json["name"].getStr(), name: json["name"].getStr(),
guildID: guild guildID: guild
) )
if (json.contains("id")):
result.id = getIDFromJson(json["id"].getStr())
if (json.contains("roles")): if (json.contains("roles")):
for role in json["roles"]: for role in json["roles"]:
result.roles.add(getIDFromJson(role.getStr())) result.roles.add(getIDFromJson(role.getStr()))