fix(Message): move messageSnapshots initialization to the correct position
This commit is contained in:
@@ -267,29 +267,6 @@ class Message extends Base {
|
|||||||
this.poll ??= null;
|
this.poll ??= null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.message_snapshots) {
|
|
||||||
/**
|
|
||||||
* The message associated with the message reference
|
|
||||||
* @type {Collection<Snowflake, Message>}
|
|
||||||
*/
|
|
||||||
this.messageSnapshots = data.message_snapshots.reduce((coll, snapshot) => {
|
|
||||||
const channel = this.client.channels.cache.get(this.reference.channelId);
|
|
||||||
const snapshotData = {
|
|
||||||
...snapshot.message,
|
|
||||||
id: this.reference.messageId,
|
|
||||||
channel_id: this.reference.channelId,
|
|
||||||
guild_id: this.reference.guildId,
|
|
||||||
};
|
|
||||||
|
|
||||||
return coll.set(
|
|
||||||
this.reference.messageId,
|
|
||||||
channel ? channel.messages._add(snapshotData) : new this.constructor(this.client, snapshotData),
|
|
||||||
);
|
|
||||||
}, new Collection());
|
|
||||||
} else {
|
|
||||||
this.messageSnapshots ??= new Collection();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('application' in data) {
|
if ('application' in data) {
|
||||||
/**
|
/**
|
||||||
* Supplemental application information for group activities
|
* Supplemental application information for group activities
|
||||||
@@ -403,6 +380,29 @@ class Message extends Base {
|
|||||||
this.interaction ??= null;
|
this.interaction ??= null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data.message_snapshots) {
|
||||||
|
/**
|
||||||
|
* The message associated with the message reference
|
||||||
|
* @type {Collection<Snowflake, Message>}
|
||||||
|
*/
|
||||||
|
this.messageSnapshots = data.message_snapshots.reduce((coll, snapshot) => {
|
||||||
|
const channel = this.client.channels.cache.get(this.reference.channelId);
|
||||||
|
const snapshotData = {
|
||||||
|
...snapshot.message,
|
||||||
|
id: this.reference.messageId,
|
||||||
|
channel_id: this.reference.channelId,
|
||||||
|
guild_id: this.reference.guildId,
|
||||||
|
};
|
||||||
|
|
||||||
|
return coll.set(
|
||||||
|
this.reference.messageId,
|
||||||
|
channel ? channel.messages._add(snapshotData) : new this.constructor(this.client, snapshotData),
|
||||||
|
);
|
||||||
|
}, new Collection());
|
||||||
|
} else {
|
||||||
|
this.messageSnapshots ??= new Collection();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A call associated with a message
|
* A call associated with a message
|
||||||
* @typedef {Object} MessageCall
|
* @typedef {Object} MessageCall
|
||||||
|
|||||||
Reference in New Issue
Block a user