mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
Fixed PM Channel bug, 3.8.2
Clients no longer crashed when receiving PM channel messages.
This commit is contained in:
@@ -11,6 +11,7 @@ var PMChannel = (function () {
|
||||
this.user = client.getUser("id", data.recipient.id);
|
||||
this.id = data.id;
|
||||
this.messages = [];
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
_createClass(PMChannel, [{
|
||||
|
||||
@@ -18,32 +18,32 @@ var Channel = (function () {
|
||||
this.messages = [];
|
||||
this.roles = [];
|
||||
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
if (data.permission_overwrites) {
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator = data.permission_overwrites[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var role = _step.value;
|
||||
|
||||
this.roles.push(new ChannelPermissions(role, this));
|
||||
}
|
||||
|
||||
//this.isPrivate = isPrivate; //not sure about the implementation of this...
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator["return"]) {
|
||||
_iterator["return"]();
|
||||
for (var _iterator = data.permission_overwrites[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var role = _step.value;
|
||||
|
||||
this.roles.push(new ChannelPermissions(role, this));
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator["return"]) {
|
||||
_iterator["return"]();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} //this.isPrivate = isPrivate; //not sure about the implementation of this...
|
||||
}
|
||||
|
||||
_createClass(Channel, [{
|
||||
|
||||
@@ -20,7 +20,13 @@ var Message = (function () {
|
||||
this.editedTimestamp = data.edited_timestamp;
|
||||
this.content = data.content.trim();
|
||||
this.channel = channel;
|
||||
this.author = this.channel.server.getMember("id", author.id);
|
||||
|
||||
if (this.isPrivate) {
|
||||
this.author = this.channel.client.getUser("id", author.id);
|
||||
} else {
|
||||
this.author = this.channel.server.getMember("id", author.id) || this.channel.client.getUser("id", author.id);
|
||||
}
|
||||
|
||||
this.attachments = data.attachments;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user