mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
Gateway v6 support
This commit is contained in:
@@ -28,18 +28,28 @@ var PMChannel = (function (_Channel) {
|
||||
_inherits(PMChannel, _Channel);
|
||||
|
||||
function PMChannel(data, client) {
|
||||
var _this = this;
|
||||
|
||||
_classCallCheck(this, PMChannel);
|
||||
|
||||
_Channel.call(this, data, client);
|
||||
|
||||
this.type = data.type || "text";
|
||||
this.type = data.type;
|
||||
this.lastMessageID = data.last_message_id || data.lastMessageID;
|
||||
this.messages = new _UtilCache2["default"]("id", client.options.maxCachedMessages);
|
||||
this.recipient = this.client.internal.users.add(new _User2["default"](data.recipient, this.client));
|
||||
if (data.recipients instanceof _UtilCache2["default"]) {
|
||||
this.recipients = data.recipients;
|
||||
} else {
|
||||
this.recipients = new _UtilCache2["default"]();
|
||||
data.recipients.forEach(function (recipient) {
|
||||
_this.recipients.add(_this.client.internal.users.add(new _User2["default"](recipient, _this.client)));
|
||||
});
|
||||
}
|
||||
this.name = data.name !== undefined ? data.name : this.name;
|
||||
this.owner = data.owner || this.client.internal.users.get("id", data.owner_id);
|
||||
this.icon = data.icon !== undefined ? data.icon : this.icon;
|
||||
}
|
||||
|
||||
/* warning! may return null */
|
||||
|
||||
PMChannel.prototype.toString = function toString() {
|
||||
return this.recipient.toString();
|
||||
};
|
||||
@@ -105,6 +115,13 @@ var PMChannel = (function (_Channel) {
|
||||
};
|
||||
|
||||
_createClass(PMChannel, [{
|
||||
key: "recipient",
|
||||
get: function get() {
|
||||
return this.recipients[0];
|
||||
}
|
||||
|
||||
/* warning! may return null */
|
||||
}, {
|
||||
key: "lastMessage",
|
||||
get: function get() {
|
||||
return this.messages.get("id", this.lastMessageID);
|
||||
|
||||
Reference in New Issue
Block a user