mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 11:33:30 +01:00
chore: properly deprecate fetchVanityCode
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const { deprecate } = require('util');
|
||||||
const Base = require('./Base');
|
const Base = require('./Base');
|
||||||
const GuildAuditLogs = require('./GuildAuditLogs');
|
const GuildAuditLogs = require('./GuildAuditLogs');
|
||||||
const GuildPreview = require('./GuildPreview');
|
const GuildPreview = require('./GuildPreview');
|
||||||
@@ -743,15 +744,13 @@ class Guild extends Base {
|
|||||||
* .catch(console.error);
|
* .catch(console.error);
|
||||||
*/
|
*/
|
||||||
fetchVanityCode() {
|
fetchVanityCode() {
|
||||||
return require('util').deprecate(() => {
|
if (!this.features.includes('VANITY_URL')) {
|
||||||
if (!this.features.includes('VANITY_URL')) {
|
return Promise.reject(new Error('VANITY_URL'));
|
||||||
return Promise.reject(new Error('VANITY_URL'));
|
}
|
||||||
}
|
return this.client.api
|
||||||
return this.client.api
|
.guilds(this.id, 'vanity-url')
|
||||||
.guilds(this.id, 'vanity-url')
|
.get()
|
||||||
.get()
|
.then(res => res.code);
|
||||||
.then(res => res.code);
|
|
||||||
}, 'fetchVanityCode() is deprecated. Use fetchVanityData() instead.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1384,4 +1383,9 @@ class Guild extends Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Guild.prototype.fetchVanityCode = deprecate(
|
||||||
|
Guild.prototype.fetchVanityCode,
|
||||||
|
'Guild#fetchVanityCode: Use fetchVanityData() instead',
|
||||||
|
);
|
||||||
|
|
||||||
module.exports = Guild;
|
module.exports = Guild;
|
||||||
|
|||||||
Reference in New Issue
Block a user