From bb4c0a8dcc3beeeda14a3a938e39a27405f11a49 Mon Sep 17 00:00:00 2001 From: Shubham Parihar Date: Thu, 7 Oct 2021 12:40:44 +0530 Subject: [PATCH] fix(Role): check for presence of icon and unicode_emoji before patching --- src/structures/Role.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/structures/Role.js b/src/structures/Role.js index 9fb5a09e3210..d5fc8beeef2c 100644 --- a/src/structures/Role.js +++ b/src/structures/Role.js @@ -20,6 +20,18 @@ class Role extends Base { */ this.guild = guild; + /** + * The icon hash of the role + * @type {?string} + */ + this.icon = null; + + /** + * The unicode emoji for the role + * @type {?string} + */ + this.unicodeEmoji = null; + if (data) this._patch(data); } @@ -91,17 +103,9 @@ class Role extends Base { */ this.deleted = false; - /** - * The icon hash of the role - * @type {?string} - */ - this.icon = data.icon; + if ('icon' in data) this.icon = data.icon; - /** - * The unicode emoji for the role - * @type {?string} - */ - this.unicodeEmoji = data.unicode_emoji; + if ('unicode_emoji' in data) this.unicodeEmoji = data.unicode_emoji; /** * The tags this role has