From 1fa7c8db9f6ef04b7a24fe4c1036ed2c9f840cba Mon Sep 17 00:00:00 2001 From: Johnson Chen Date: Mon, 20 Apr 2020 03:43:08 +1000 Subject: [PATCH] chore: properly deprecate fetchVanityCode --- src/structures/Guild.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/structures/Guild.js b/src/structures/Guild.js index ce027d2d4..371e5279e 100644 --- a/src/structures/Guild.js +++ b/src/structures/Guild.js @@ -1,5 +1,6 @@ 'use strict'; +const { deprecate } = require('util'); const Base = require('./Base'); const GuildAuditLogs = require('./GuildAuditLogs'); const GuildPreview = require('./GuildPreview'); @@ -743,15 +744,13 @@ class Guild extends Base { * .catch(console.error); */ fetchVanityCode() { - return require('util').deprecate(() => { - 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); - }, 'fetchVanityCode() is deprecated. Use fetchVanityData() instead.'); + 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); } /** @@ -1384,4 +1383,9 @@ class Guild extends Base { } } +Guild.prototype.fetchVanityCode = deprecate( + Guild.prototype.fetchVanityCode, + 'Guild#fetchVanityCode: Use fetchVanityData() instead', +); + module.exports = Guild;