Skip to content

Commit

Permalink
docs(Util): Deprecate .removeMentions() (#6866)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiralite committed Oct 24, 2021
1 parent 7621e9d commit b6c9fd6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/util/Util.js
Expand Up @@ -575,13 +575,16 @@ 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');
}

/**
* The content to have all mentions replaced by the equivalent text.
* <warn>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.</warn>
* @param {string} str The string to be converted
* @param {TextBasedChannels} channel The channel the string was sent in
* @returns {string}
Expand Down
1 change: 1 addition & 0 deletions typings/index.d.ts
Expand Up @@ -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<void>;
Expand Down

0 comments on commit b6c9fd6

Please sign in to comment.