mirror of
https://github.com/danbulant/discord.js
synced 2026-05-27 22:11:53 +00:00
fix(APIMessage): add reply user to allowedMentions (#4591)
This commit is contained in:
parent
6caeaeb391
commit
b6ddd4ce41
1 changed files with 16 additions and 1 deletions
|
|
@ -178,10 +178,25 @@ class APIMessage {
|
|||
flags = this.options.flags != null ? new MessageFlags(this.options.flags).bitfield : this.target.flags.bitfield;
|
||||
}
|
||||
|
||||
const allowedMentions =
|
||||
let allowedMentions =
|
||||
typeof this.options.allowedMentions === 'undefined'
|
||||
? this.target.client.options.allowedMentions
|
||||
: this.options.allowedMentions;
|
||||
if (this.options.reply) {
|
||||
const id = this.target.client.users.resolveID(this.options.reply);
|
||||
if (allowedMentions) {
|
||||
// Clone the object as to alter the ClientOptions object
|
||||
allowedMentions = Util.cloneObject(allowedMentions);
|
||||
const parsed = allowedMentions.parse && allowedMentions.parse.includes('users');
|
||||
// Check if the mention won't be parsed, and isn't supplied in `users`
|
||||
if (!parsed && !(allowedMentions.users && allowedMentions.users.includes(id))) {
|
||||
if (!allowedMentions.users) allowedMentions.users = [];
|
||||
allowedMentions.users.push(id);
|
||||
}
|
||||
} else {
|
||||
allowedMentions = { users: [id] };
|
||||
}
|
||||
}
|
||||
|
||||
this.data = {
|
||||
content,
|
||||
|
|
|
|||
Loading…
Reference in a new issue