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

@@ -22,24 +22,33 @@ class Team extends Base {
*/
this.id = data.id;
/**
* The name of the Team
* @type {string}
*/
this.name = data.name;
if ('name' in data) {
/**
* The name of the Team
* @type {string}
*/
this.name = data.name;
}
/**
* The Team's icon hash
* @type {?string}
*/
this.icon = data.icon ?? null;
/**
* The Team's owner id
* @type {?Snowflake}
*/
this.ownerId = data.owner_user_id ?? null;
if ('icon' in data) {
/**
* The Team's icon hash
* @type {?string}
*/
this.icon = data.icon;
} else {
this.icon ??= null;
}
if ('owner_user_id' in data) {
/**
* The Team's owner id
* @type {?Snowflake}
*/
this.ownerId = data.owner_user_id;
} else {
this.ownerId ??= null;
}
/**
* The Team's members
* @type {Collection<Snowflake, TeamMember>}