fix(Util): Fix cleanContent mention exploit (#4663)

This commit is contained in:
모메MoMe
2020-07-29 19:47:20 +09:00
committed by GitHub
parent 0e61fca974
commit fb1dd6b53a

View File

@@ -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 => {