mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 12:33:30 +01:00
fix(Util): Fix cleanContent mention exploit (#4663)
This commit is contained in:
@@ -560,15 +560,15 @@ class Util {
|
|||||||
const id = input.replace(/<|!|>|@/g, '');
|
const id = input.replace(/<|!|>|@/g, '');
|
||||||
if (message.channel.type === 'dm') {
|
if (message.channel.type === 'dm') {
|
||||||
const user = message.client.users.cache.get(id);
|
const user = message.client.users.cache.get(id);
|
||||||
return user ? `@${user.username}` : input;
|
return user ? Util.removeMentions(`@${user.username}`) : input;
|
||||||
}
|
}
|
||||||
|
|
||||||
const member = message.channel.guild.members.cache.get(id);
|
const member = message.channel.guild.members.cache.get(id);
|
||||||
if (member) {
|
if (member) {
|
||||||
return `@${member.displayName}`;
|
return Util.removeMentions(`@${member.displayName}`);
|
||||||
} else {
|
} else {
|
||||||
const user = message.client.users.cache.get(id);
|
const user = message.client.users.cache.get(id);
|
||||||
return user ? `@${user.username}` : input;
|
return user ? Util.removeMentions(`@${user.username}`) : input;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.replace(/<#[0-9]+>/g, input => {
|
.replace(/<#[0-9]+>/g, input => {
|
||||||
|
|||||||
Reference in New Issue
Block a user