Validate invite if possible

This commit is contained in:
abalabahaha
2016-01-03 11:14:17 -08:00
parent 718f0b9543
commit 2a00064646
4 changed files with 17 additions and 6 deletions

View File

@@ -929,7 +929,12 @@ var InternalClient = (function () {
}
return this.apiRequest("get", _Constants.Endpoints.INVITE(invite), true).then(function (res) {
return new _StructuresInvite2["default"](res, _this21.channels.get("id", res.channel.id), _this21.client);
if (!_this21.channels.has("id", res.channel.id)) {
return new _StructuresInvite2["default"](res, null, _this21.client);
}
return _this21.apiRequest("post", _Constants.Endpoints.CHANNEL_INVITES(res.channel.id), true, { validate: invite }).then(function (res2) {
return new _StructuresInvite2["default"](res2, _this21.channels.get("id", res.channel.id), _this21.client);
});
});
};

View File

@@ -10,7 +10,7 @@ var Invite = (function () {
this.maxAge = data.max_age;
this.code = data.code;
if (data.chan) {
if (chan) {
this.channel = chan;
this.server = chan.server;
} else {