Small fixes

This commit is contained in:
abalabahaha
2016-02-18 20:49:03 -08:00
parent e4641fe701
commit 5c9865fc3c
3 changed files with 69 additions and 81 deletions

View File

@@ -874,9 +874,13 @@ var InternalClient = (function () {
throw new Error("user not found");
}
return !!role.server.rolesOf(member).find(function (r) {
return r.id == role.id;
});
var roledata = role.server.rolesOf(member);
if (roledata) {
return roledata.find(function (r) {
return r.id == role.id;
});
}
return null;
};
//def removeMemberFromRole
@@ -942,13 +946,7 @@ var InternalClient = (function () {
InternalClient.prototype.createInvite = function createInvite(chanServ, options) {
var _this25 = this;
if (chanServ instanceof _StructuresChannel2["default"]) {
// do something
} else if (chanServ instanceof _StructuresServer2["default"]) {
// do something
} else {
chanServ = this.resolver.resolveServer(chanServ) || this.resolver.resolveChannel(chanServ);
}
chanServ = this.resolver.resolveChannel(chanServ);
if (!chanServ) {
throw new Error("couldn't resolve where");
@@ -965,14 +963,7 @@ var InternalClient = (function () {
options.xkcdpass = options.xkcd || false;
}
var epoint;
if (chanServ instanceof _StructuresChannel2["default"]) {
epoint = _Constants.Endpoints.CHANNEL_INVITES(chanServ.id);
} else {
epoint = _Constants.Endpoints.SERVER_INVITES(chanServ.id);
}
return this.apiRequest("post", epoint, true, options).then(function (res) {
return this.apiRequest("post", _Constants.Endpoints.CHANNEL_INVITES(chanServ.id), true, options).then(function (res) {
return new _StructuresInvite2["default"](res, _this25.channels.get("id", res.channel.id), _this25.client);
});
};
@@ -1107,6 +1098,9 @@ var InternalClient = (function () {
this.sendWS(packet);
this.bot.user.status = this.idleStatus;
this.bot.user.game = this.game;
return Promise.resolve();
};