mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 17:13:31 +01:00
feat: reimplement disableEveryone into disableMentions
* User input sanitation: reimplement disableEveryone into disableMentions * Change default value of ClientOptions#disableMentions to 'none' * Update type declarations of disableMentions to include default * update for compliance with ESLint * Overlooked these files. Updated for complete compliance with ESLint
This commit is contained in:
@@ -91,8 +91,16 @@ class APIMessage {
|
||||
const disableMentions = typeof this.options.disableMentions === 'undefined' ?
|
||||
this.target.client.options.disableMentions :
|
||||
this.options.disableMentions;
|
||||
if (disableMentions) {
|
||||
if (disableMentions === 'all') {
|
||||
content = Util.removeMentions(content || '');
|
||||
} else if (disableMentions === 'everyone') {
|
||||
content = (content || '').replace(/@([^<>@ ]*)/gsmu, (match, target) => {
|
||||
if (target.match(/^[&!]?\d+$/)) {
|
||||
return `@${target}`;
|
||||
} else {
|
||||
return `@\u200b${target}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const isSplit = typeof this.options.split !== 'undefined' && this.options.split !== false;
|
||||
|
||||
Reference in New Issue
Block a user