From 3ea9ac57ddb6fa48ba26c5e181488bfcdef6b48a Mon Sep 17 00:00:00 2001 From: Sugden <28943913+NotSugden@users.noreply.github.com> Date: Sat, 25 Jan 2020 14:08:25 +0000 Subject: [PATCH] fix(ClientUser): verified and enabled properties resetting (#3733) * fix(ClientUser) verified and enabled properties resetting * set this.mfaEnabled to null if it is undefined * add missing curly brackets * fix typo --- src/structures/ClientUser.js | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/structures/ClientUser.js b/src/structures/ClientUser.js index 3f2883efc..a9512a646 100644 --- a/src/structures/ClientUser.js +++ b/src/structures/ClientUser.js @@ -16,17 +16,23 @@ class ClientUser extends Structures.get('User') { _patch(data) { super._patch(data); - /** - * Whether or not this account has been verified - * @type {boolean} - */ - this.verified = data.verified; + if ('verified' in data) { + /** + * Whether or not this account has been verified + * @type {boolean} + */ + this.verified = data.verified; + } - /** - * If the bot's {@link ClientApplication#owner Owner} has MFA enabled on their account - * @type {?boolean} - */ - this.mfaEnabled = typeof data.mfa_enabled === 'boolean' ? data.mfa_enabled : null; + if ('mfa_enabled' in data) { + /** + * If the bot's {@link ClientApplication#owner Owner} has MFA enabled on their account + * @type {?boolean} + */ + this.mfaEnabled = typeof data.mfa_enabled === 'boolean' ? data.mfa_enabled : null; + } else if (typeof this.mfaEnabled === 'undefined') { + this.mfaEnabled = null; + } if (data.token) this.client.token = data.token; }