mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
refactor(Message): remove stored edit history (#5155)
This commit is contained in:
committed by
GitHub
parent
6a77453532
commit
8c2e6b70b8
@@ -185,13 +185,6 @@ class Message extends Base {
|
||||
}
|
||||
: null;
|
||||
|
||||
/**
|
||||
* The previous versions of the message, sorted with the most recent first
|
||||
* @type {Message[]}
|
||||
* @private
|
||||
*/
|
||||
this._edits = [];
|
||||
|
||||
if (this.member && data.member) {
|
||||
this.member._patch(data.member);
|
||||
} else if (data.member && this.guild && this.author) {
|
||||
@@ -246,11 +239,6 @@ class Message extends Base {
|
||||
*/
|
||||
patch(data) {
|
||||
const clone = this._clone();
|
||||
const { messageEditHistoryMaxSize } = this.client.options;
|
||||
if (messageEditHistoryMaxSize !== 0) {
|
||||
const editsLimit = messageEditHistoryMaxSize === -1 ? Infinity : messageEditHistoryMaxSize;
|
||||
if (this._edits.unshift(clone) > editsLimit) this._edits.pop();
|
||||
}
|
||||
|
||||
if ('edited_timestamp' in data) this.editedTimestamp = new Date(data.edited_timestamp).getTime();
|
||||
if ('content' in data) this.content = data.content;
|
||||
@@ -383,18 +371,6 @@ class Message extends Base {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* An array of cached versions of the message, including the current version
|
||||
* Sorted from latest (first) to oldest (last)
|
||||
* @type {Message[]}
|
||||
* @readonly
|
||||
*/
|
||||
get edits() {
|
||||
const copy = this._edits.slice();
|
||||
copy.unshift(this);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the message is editable by the client user
|
||||
* @type {boolean}
|
||||
|
||||
Reference in New Issue
Block a user