mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
feat(MessageMentions): add repliedUser (#5905)
This commit is contained in:
@@ -190,7 +190,14 @@ class Message extends Base {
|
||||
* All valid mentions that the message contains
|
||||
* @type {MessageMentions}
|
||||
*/
|
||||
this.mentions = new Mentions(this, data.mentions, data.mention_roles, data.mention_everyone, data.mention_channels);
|
||||
this.mentions = new Mentions(
|
||||
this,
|
||||
data.mentions,
|
||||
data.mention_roles,
|
||||
data.mention_everyone,
|
||||
data.mention_channels,
|
||||
data.referenced_message?.author,
|
||||
);
|
||||
|
||||
/**
|
||||
* ID of the webhook that sent the message, if applicable
|
||||
@@ -325,6 +332,7 @@ class Message extends Base {
|
||||
'mention_roles' in data ? data.mention_roles : this.mentions.roles,
|
||||
'mention_everyone' in data ? data.mention_everyone : this.mentions.everyone,
|
||||
'mention_channels' in data ? data.mention_channels : this.mentions.crosspostedChannels,
|
||||
'referenced_message' in data ? data.referenced_message.author : this.mentions.repliedUser,
|
||||
);
|
||||
|
||||
this.flags = new MessageFlags('flags' in data ? data.flags : 0).freeze();
|
||||
|
||||
@@ -8,7 +8,7 @@ const Util = require('../util/Util');
|
||||
* Keeps track of mentions in a {@link Message}.
|
||||
*/
|
||||
class MessageMentions {
|
||||
constructor(message, users, roles, everyone, crosspostedChannels) {
|
||||
constructor(message, users, roles, everyone, crosspostedChannels, repliedUser) {
|
||||
/**
|
||||
* The client the message is from
|
||||
* @type {Client}
|
||||
@@ -125,6 +125,12 @@ class MessageMentions {
|
||||
} else {
|
||||
this.crosspostedChannels = new Collection();
|
||||
}
|
||||
|
||||
/**
|
||||
* The author of the message that this message is a reply to
|
||||
* @type {?User}
|
||||
*/
|
||||
this.repliedUser = repliedUser ? this.client.users.add(repliedUser) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user