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

@@ -15,36 +15,47 @@ class AnonymousGuild extends BaseGuild {
}
_patch(data) {
this.features = data.features;
/**
* The hash of the guild invite splash image
* @type {?string}
*/
this.splash = data.splash;
if ('features' in data) this.features = data.features;
/**
* The hash of the guild banner
* @type {?string}
*/
this.banner = data.banner;
if ('splash' in data) {
/**
* The hash of the guild invite splash image
* @type {?string}
*/
this.splash = data.splash;
}
/**
* The description of the guild, if any
* @type {?string}
*/
this.description = data.description;
if ('banner' in data) {
/**
* The hash of the guild banner
* @type {?string}
*/
this.banner = data.banner;
}
/**
* The verification level of the guild
* @type {VerificationLevel}
*/
this.verificationLevel = VerificationLevels[data.verification_level];
if ('description' in data) {
/**
* The description of the guild, if any
* @type {?string}
*/
this.description = data.description;
}
/**
* The vanity invite code of the guild, if any
* @type {?string}
*/
this.vanityURLCode = data.vanity_url_code;
if ('verification_level' in data) {
/**
* The verification level of the guild
* @type {VerificationLevel}
*/
this.verificationLevel = VerificationLevels[data.verification_level];
}
if ('vanity_url_code' in data) {
/**
* The vanity invite code of the guild, if any
* @type {?string}
*/
this.vanityURLCode = data.vanity_url_code;
}
if ('nsfw_level' in data) {
/**