mirror of
https://github.com/danbulant/discord.js
synced 2026-07-05 19:20:42 +00:00
fix(Util): cleanContent should remove mentions after formatting… (#3936)
This commit is contained in:
parent
d43f78c845
commit
44ac5fe6df
1 changed files with 9 additions and 9 deletions
|
|
@ -555,15 +555,6 @@ class Util {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
static cleanContent(str, message) {
|
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
|
str = str
|
||||||
.replace(/<@!?[0-9]+>/g, input => {
|
.replace(/<@!?[0-9]+>/g, input => {
|
||||||
const id = input.replace(/<|!|>|@/g, '');
|
const id = input.replace(/<|!|>|@/g, '');
|
||||||
|
|
@ -589,6 +580,15 @@ class Util {
|
||||||
const role = message.guild.roles.cache.get(input.replace(/<|@|>|&/g, ''));
|
const role = message.guild.roles.cache.get(input.replace(/<|@|>|&/g, ''));
|
||||||
return role ? `@${role.name}` : input;
|
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') {
|
if (message.client.options.disableMentions === 'all') {
|
||||||
return Util.removeMentions(str);
|
return Util.removeMentions(str);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue