Add guildID field in Role type.

This commit is contained in:
SeanOMik 2020-06-18 23:57:23 -05:00
parent 4bf2ad785e
commit 57c4a44fca
No known key found for this signature in database
GPG Key ID: FA4D55AC05268A88
1 changed files with 6 additions and 3 deletions

View File

@ -8,8 +8,9 @@ type Role* = ref object of DiscordObject
permissions*: Permissions permissions*: Permissions
managed*: bool managed*: bool
mentionable*: bool mentionable*: bool
guildID*: snowflake
proc newRole*(json: JsonNode): Role = proc newRole*(json: JsonNode, guild: snowflake): Role =
result = Role( result = Role(
id: getIDFromJson(json["id"].getStr()), id: getIDFromJson(json["id"].getStr()),
name: json["name"].getStr(), name: json["name"].getStr(),
@ -17,7 +18,9 @@ proc newRole*(json: JsonNode): Role =
hoist: json["hoist"].getBool(), hoist: json["hoist"].getBool(),
position: uint(json["position"].getInt()), position: uint(json["position"].getInt()),
managed: json["managed"].getBool(), managed: json["managed"].getBool(),
mentionable: json["mentionable"].getBool() mentionable: json["mentionable"].getBool(),
guildID: guild,
permissions: newPermissions(result.id, PermissionType.permTypeRole,
uint(json["permissions"].getInt()))
) )
result.permissions = newPermissions(result.id, PermissionType.permTypeRole, uint(json["permissions"].getInt()))