feat(APIMessage): remove disableMentions (#4836)

* chore: remove disableMentions

* style: fix eslint
This commit is contained in:
Advaith
2020-12-14 04:51:31 -08:00
committed by GitHub
parent 9c7fe34c50
commit 41078997ae
8 changed files with 1 additions and 94 deletions

View File

@@ -23,7 +23,6 @@ const browser = (exports.browser = typeof window !== 'undefined');
* (-1 or Infinity for unlimited - don't do this without sweeping, otherwise memory usage may climb indefinitely.)
* @property {boolean} [fetchAllMembers=false] Whether to cache all guild members and users upon startup, as well as
* upon joining a guild (should be avoided whenever possible)
* @property {DisableMentionType} [disableMentions='none'] Default value for {@link MessageOptions#disableMentions}
* @property {MessageMentionOptions} [allowedMentions] Default value for {@link MessageOptions#allowedMentions}
* @property {PartialType[]} [partials] Structures allowed to be partial. This means events can be emitted even when
* they're missing all the data for a particular structure. See the "Partials" topic listed in the sidebar for some
@@ -47,7 +46,6 @@ exports.DefaultOptions = {
messageSweepInterval: 0,
messageEditHistoryMaxSize: -1,
fetchAllMembers: false,
disableMentions: 'none',
partials: [],
restWsBridgeTimeout: 5000,
restRequestTimeout: 15000,

View File

@@ -584,20 +584,7 @@ class Util {
const role = message.guild.roles.cache.get(input.replace(/<|@|>|&/g, ''));
return role ? `@${role.name}` : input;
});
if (message.client.options.disableMentions === 'everyone') {
str = str.replace(/@([^<>@ ]*)/gmsu, (match, target) => {
if (target.match(/^[&!]?\d+$/)) {
return `@${target}`;
} else {
return `@\u200b${target}`;
}
});
}
if (message.client.options.disableMentions === 'all') {
return Util.removeMentions(str);
} else {
return str;
}
return str;
}
/**