fix: don't patch set data with undefined (#6694)

This commit is contained in:
Rodry
2021-10-03 13:59:52 +01:00
committed by GitHub
parent 8b4456e0aa
commit 9eb9591473
33 changed files with 1211 additions and 795 deletions

View File

@@ -41,8 +41,8 @@ class User extends Base {
* @type {?string}
*/
this.username = data.username;
} else if (typeof this.username !== 'string') {
this.username = null;
} else {
this.username ??= null;
}
if ('bot' in data) {
@@ -61,8 +61,8 @@ class User extends Base {
* @type {?string}
*/
this.discriminator = data.discriminator;
} else if (typeof this.discriminator !== 'string') {
this.discriminator = null;
} else {
this.discriminator ??= null;
}
if ('avatar' in data) {
@@ -71,8 +71,8 @@ class User extends Base {
* @type {?string}
*/
this.avatar = data.avatar;
} else if (typeof this.avatar !== 'string') {
this.avatar = null;
} else {
this.avatar ??= null;
}
if ('banner' in data) {
@@ -82,8 +82,8 @@ class User extends Base {
* @type {?string}
*/
this.banner = data.banner;
} else if (typeof this.banner !== 'string') {
this.banner = null;
} else {
this.banner ??= null;
}
if ('accent_color' in data) {