docs: deprecate .deleted getters (#7107)

This commit is contained in:
Antonio Román
2021-12-14 19:34:27 +01:00
committed by GitHub
parent 1e00fc2001
commit d43f68488e
10 changed files with 172 additions and 36 deletions

View File

@@ -36,6 +36,7 @@ const Util = require('../util/Util');
let deprecationEmittedForSetChannelPositions = false;
let deprecationEmittedForSetRolePositions = false;
let deprecationEmittedForDeleted = false;
/**
* @type {WeakSet<Guild>}
@@ -130,12 +131,29 @@ class Guild extends AnonymousGuild {
/**
* Whether or not the structure has been deleted
* @type {boolean}
* @deprecated This will be removed in the next major version, see https://github.com/discordjs/discord.js/issues/7091
*/
get deleted() {
if (!deprecationEmittedForDeleted) {
deprecationEmittedForDeleted = true;
process.emitWarning(
'Guild#deleted is deprecated, see https://github.com/discordjs/discord.js/issues/7091.',
'DeprecationWarning',
);
}
return deletedGuilds.has(this);
}
set deleted(value) {
if (!deprecationEmittedForDeleted) {
deprecationEmittedForDeleted = true;
process.emitWarning(
'Guild#deleted is deprecated, see https://github.com/discordjs/discord.js/issues/7091.',
'DeprecationWarning',
);
}
if (value) deletedGuilds.add(this);
else deletedGuilds.delete(this);
}