Skip to content

Commit

Permalink
fix(Util): cleanContent should remove mentions after formatting… (#3936)
Browse files Browse the repository at this point in the history
  • Loading branch information
NotSugden authored Mar 14, 2020
1 parent d43f78c commit 44ac5fe
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/util/Util.js
Original file line number Diff line number Diff line change
Expand Up @@ -555,15 +555,6 @@ class Util {
* @returns {string}
*/
static cleanContent(str, message) {
if (message.client.options.disableMentions === 'everyone') {
str = str.replace(/@([^<>@ ]*)/gmsu, (match, target) => {
if (target.match(/^[&!]?\d+$/)) {
return `@${target}`;
} else {
return `@\u200b${target}`;
}
});
}
str = str
.replace(/<@!?[0-9]+>/g, input => {
const id = input.replace(/<|!|>|@/g, '');
Expand All @@ -589,6 +580,15 @@ class Util {
const role = message.guild.roles.cache.get(input.replace(/<|@|>|&/g, ''));
return role ? `@${role.name}` : input;
});
if (message.client.options.disableMentions === 'everyone') {
str = str.replace(/@([^<>@ ]*)/gmsu, (match, target) => {
if (target.match(/^[&!]?\d+$/)) {
return `@${target}`;
} else {
return `@\u200b${target}`;
}
});
}
if (message.client.options.disableMentions === 'all') {
return Util.removeMentions(str);
} else {
Expand Down

0 comments on commit 44ac5fe

Please sign in to comment.