From b6c9fd691f5e11012e2a75079abe5961c8cc89cd Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Sun, 24 Oct 2021 23:35:13 +0100 Subject: [PATCH] docs(Util): Deprecate `.removeMentions()` (#6866) --- src/util/Util.js | 3 +++ typings/index.d.ts | 1 + 2 files changed, 4 insertions(+) diff --git a/src/util/Util.js b/src/util/Util.js index 79884ecbeffc..55e3b2b524a5 100644 --- a/src/util/Util.js +++ b/src/util/Util.js @@ -575,6 +575,7 @@ class Util extends null { * Breaks user, role and everyone/here mentions by adding a zero width space after every @ character * @param {string} str The string to sanitize * @returns {string} + * @deprecated Use {@link BaseMessageOptions#allowedMentions} instead. */ static removeMentions(str) { return str.replaceAll('@', '@\u200b'); @@ -582,6 +583,8 @@ class Util extends null { /** * The content to have all mentions replaced by the equivalent text. + * When {@link Util.removeMentions} is removed, this method will no longer sanitize mentions. + * Use {@link BaseMessageOptions#allowedMentions} instead to prevent mentions when sending a message. * @param {string} str The string to be converted * @param {TextBasedChannels} channel The channel the string was sent in * @returns {string} diff --git a/typings/index.d.ts b/typings/index.d.ts index 97c1865c281b..d5199212f0ca 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -2121,6 +2121,7 @@ export class Util extends null { public static basename(path: string, ext?: string): string; public static binaryToId(num: string): Snowflake; public static cleanContent(str: string, channel: TextBasedChannels): string; + /** @deprecated Use {@link MessageOptions.allowedMentions} to control mentions in a message instead. */ public static removeMentions(str: string): string; public static cloneObject(obj: unknown): unknown; public static delayFor(ms: number): Promise;