mirror of
https://github.com/danbulant/discord.js
synced 2026-06-09 17:52:55 +00:00
fix(Guild): fix vanityURLUses desc, internally use fetchVanityData (#4335)
* docs(vanityURLUses): use fetchVanityData * feat(fetchVanityCode): internally call fetchVanityData * Update src/structures/Guild.js
This commit is contained in:
parent
8030612e52
commit
1c275afd7c
1 changed files with 2 additions and 8 deletions
|
|
@ -336,7 +336,7 @@ class Guild extends Base {
|
||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
/**
|
/**
|
||||||
* The use count of the vanity URL code of the guild, if any
|
* The use count of the vanity URL code of the guild, if any
|
||||||
* <info>You will need to fetch the guild using {@link Guild#fetchVanityCode} if you want to receive this parameter</info>
|
* <info>You will need to fetch this parameter using {@link Guild#fetchVanityData} if you want to receive it</info>
|
||||||
* @type {?number}
|
* @type {?number}
|
||||||
*/
|
*/
|
||||||
this.vanityURLUses = null;
|
this.vanityURLUses = null;
|
||||||
|
|
@ -771,13 +771,7 @@ class Guild extends Base {
|
||||||
* .catch(console.error);
|
* .catch(console.error);
|
||||||
*/
|
*/
|
||||||
fetchVanityCode() {
|
fetchVanityCode() {
|
||||||
if (!this.features.includes('VANITY_URL')) {
|
return this.fetchVanityData().then(vanity => vanity.code);
|
||||||
return Promise.reject(new Error('VANITY_URL'));
|
|
||||||
}
|
|
||||||
return this.client.api
|
|
||||||
.guilds(this.id, 'vanity-url')
|
|
||||||
.get()
|
|
||||||
.then(res => res.code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue