From 1c275afd7cee4b3663a04f77b0271ac80e927a5e Mon Sep 17 00:00:00 2001 From: Papaia <43409674+Papaia@users.noreply.github.com> Date: Thu, 4 Jun 2020 20:17:18 +0300 Subject: [PATCH] fix(Guild): fix vanityURLUses desc, internally use fetchVanityData (#4335) * docs(vanityURLUses): use fetchVanityData * feat(fetchVanityCode): internally call fetchVanityData * Update src/structures/Guild.js --- src/structures/Guild.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/structures/Guild.js b/src/structures/Guild.js index dea3781c3..aa6158d49 100644 --- a/src/structures/Guild.js +++ b/src/structures/Guild.js @@ -336,7 +336,7 @@ class Guild extends Base { /* eslint-disable max-len */ /** * The use count of the vanity URL code of the guild, if any - * You will need to fetch the guild using {@link Guild#fetchVanityCode} if you want to receive this parameter + * You will need to fetch this parameter using {@link Guild#fetchVanityData} if you want to receive it * @type {?number} */ this.vanityURLUses = null; @@ -771,13 +771,7 @@ class Guild extends Base { * .catch(console.error); */ fetchVanityCode() { - if (!this.features.includes('VANITY_URL')) { - return Promise.reject(new Error('VANITY_URL')); - } - return this.client.api - .guilds(this.id, 'vanity-url') - .get() - .then(res => res.code); + return this.fetchVanityData().then(vanity => vanity.code); } /**