mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +01:00
fix(Message): flags not being parsed on some edits (#5886)
* fix(Message): flags not being parsed on some edits * refactor(MessageManager): access cache once
This commit is contained in:
@@ -74,6 +74,16 @@ class APIMessage {
|
||||
return this.target instanceof Message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wether or not the target is a message manager
|
||||
* @type {boolean}
|
||||
* @readonly
|
||||
*/
|
||||
get isMessageManager() {
|
||||
const MessageManager = require('../managers/MessageManager');
|
||||
return this.target instanceof MessageManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not the target is an interaction
|
||||
* @type {boolean}
|
||||
@@ -156,9 +166,9 @@ class APIMessage {
|
||||
}
|
||||
|
||||
let flags;
|
||||
if (this.isMessage) {
|
||||
if (this.isMessage || this.isMessageManager) {
|
||||
// eslint-disable-next-line eqeqeq
|
||||
flags = this.options.flags != null ? new MessageFlags(this.options.flags).bitfield : this.target.flags.bitfield;
|
||||
flags = this.options.flags != null ? new MessageFlags(this.options.flags).bitfield : this.target.flags?.bitfield;
|
||||
} else if (isInteraction && this.options.ephemeral) {
|
||||
flags = MessageFlags.FLAGS.EPHEMERAL;
|
||||
}
|
||||
@@ -300,5 +310,6 @@ module.exports = APIMessage;
|
||||
|
||||
/**
|
||||
* A target for a message.
|
||||
* @typedef {TextChannel|DMChannel|User|GuildMember|Webhook|WebhookClient|Interaction|InteractionWebhook} MessageTarget
|
||||
* @typedef {TextChannel|DMChannel|User|GuildMember|Webhook|WebhookClient|Interaction|InteractionWebhook|
|
||||
* Message|MessageManager} MessageTarget
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user