From 57c4a44fca722e2d3ef02e2d0ab64c6b91d6b16a Mon Sep 17 00:00:00 2001 From: SeanOMik Date: Thu, 18 Jun 2020 23:57:23 -0500 Subject: [PATCH] Add guildID field in Role type. --- src/role.nim | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/role.nim b/src/role.nim index 176a66e..f37a11a 100644 --- a/src/role.nim +++ b/src/role.nim @@ -8,8 +8,9 @@ type Role* = ref object of DiscordObject permissions*: Permissions managed*: bool mentionable*: bool + guildID*: snowflake -proc newRole*(json: JsonNode): Role = +proc newRole*(json: JsonNode, guild: snowflake): Role = result = Role( id: getIDFromJson(json["id"].getStr()), name: json["name"].getStr(), @@ -17,7 +18,9 @@ proc newRole*(json: JsonNode): Role = hoist: json["hoist"].getBool(), position: uint(json["position"].getInt()), 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())) \ No newline at end of file