mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +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, '');
|
||||
if (message.channel.type === 'dm') {
|
||||
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);
|
||||
if (member) {
|
||||
return `@${member.displayName}`;
|
||||
return Util.removeMentions(`@${member.displayName}`);
|
||||
} else {
|
||||
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 => {
|
||||
|
||||
Reference in New Issue
Block a user