Add Message.edits (#636)

* Add Message.edits

* Make travis happy

* Change @type for consistency
This commit is contained in:
Programmix
2016-09-06 16:20:35 -07:00
committed by Schuyler Cebulskie
parent e4cac2d575
commit 17bee8084e
2 changed files with 12 additions and 0 deletions

View File

@@ -123,6 +123,8 @@ class Message {
}
}
this._edits = [];
/**
* Whether or not this message was sent by Discord, not actually a user (e.g. pin notifications)
* @type {boolean}
@@ -147,6 +149,15 @@ class Message {
return new Date(this._editedTimestamp);
}
/**
* An array of cached versions of the message, including the current version.
* Sorted from latest (first) to oldest (last).
* @type {Message[]}
*/
get edits() {
return this._edits.slice().unshift(this);
}
patch(data) { // eslint-disable-line complexity
if (data.author) {
this.author = this.client.users.get(data.author.id);