mirror of
https://github.com/danbulant/discord.js
synced 2026-07-07 12:11:11 +00:00
fix(Util): Fix cleanContent mention exploit (#4663)
This commit is contained in:
parent
0e61fca974
commit
fb1dd6b53a
1 changed files with 3 additions and 3 deletions
|
|
@ -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 => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue