mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
chore: Emit deprecation messages (#6994)
This commit is contained in:
@@ -34,6 +34,9 @@ const DataResolver = require('../util/DataResolver');
|
||||
const SystemChannelFlags = require('../util/SystemChannelFlags');
|
||||
const Util = require('../util/Util');
|
||||
|
||||
let deprecationEmittedForSetChannelPositions = false;
|
||||
let deprecationEmittedForSetRolePositions = false;
|
||||
|
||||
/**
|
||||
* Represents a guild (or a server) on Discord.
|
||||
* <info>It's recommended to see if a guild is available before performing operations or reading data from it. You can
|
||||
@@ -1195,6 +1198,15 @@ class Guild extends AnonymousGuild {
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setChannelPositions(channelPositions) {
|
||||
if (!deprecationEmittedForSetChannelPositions) {
|
||||
process.emitWarning(
|
||||
'The Guild#setChannelPositions method is deprecated. Use GuildChannelManager#setPositions instead.',
|
||||
'DeprecationWarning',
|
||||
);
|
||||
|
||||
deprecationEmittedForSetChannelPositions = true;
|
||||
}
|
||||
|
||||
return this.channels.setPositions(channelPositions);
|
||||
}
|
||||
|
||||
@@ -1216,6 +1228,15 @@ class Guild extends AnonymousGuild {
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setRolePositions(rolePositions) {
|
||||
if (!deprecationEmittedForSetRolePositions) {
|
||||
process.emitWarning(
|
||||
'The Guild#setRolePositions method is deprecated. Use RoleManager#setPositions instead.',
|
||||
'DeprecationWarning',
|
||||
);
|
||||
|
||||
deprecationEmittedForSetRolePositions = true;
|
||||
}
|
||||
|
||||
return this.roles.setPositions(rolePositions);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user