mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +01:00
chore: Emit deprecation messages (#6994)
This commit is contained in:
@@ -9,6 +9,8 @@ const { Error: DiscordError, RangeError, TypeError } = require('../errors');
|
||||
const has = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
|
||||
const isObject = d => typeof d === 'object' && d !== null;
|
||||
|
||||
let deprecationEmittedForRemoveMentions = false;
|
||||
|
||||
/**
|
||||
* Contains various general-purpose utility methods.
|
||||
*/
|
||||
@@ -578,6 +580,15 @@ class Util extends null {
|
||||
* @deprecated Use {@link BaseMessageOptions#allowedMentions} instead.
|
||||
*/
|
||||
static removeMentions(str) {
|
||||
if (!deprecationEmittedForRemoveMentions) {
|
||||
process.emitWarning(
|
||||
'The Util.removeMentions method is deprecated. Use MessageOptions#allowedMentions instead.',
|
||||
'DeprecationWarning',
|
||||
);
|
||||
|
||||
deprecationEmittedForRemoveMentions = true;
|
||||
}
|
||||
|
||||
return str.replaceAll('@', '@\u200b');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user