mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 01:53:30 +01:00
feat(APIMessage): remove disableMentions (#4836)
* chore: remove disableMentions * style: fix eslint
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user