Possibly fix #404, #405, #409

This commit is contained in:
abalabahaha
2016-06-03 18:36:17 -07:00
parent 2bd7d9dc24
commit 6cd0561014
4 changed files with 29 additions and 11 deletions

View File

@@ -657,7 +657,7 @@ var InternalClient = (function () {
return Promise.reject(new Error("Client is not logged in!"));
}
return this.apiRequest("post", _Constants.Endpoints.LOGOUT, true).then(function () {
var disconnect = function disconnect() {
if (_this12.websocket) {
_this12.websocket.close(1000);
_this12.websocket = null;
@@ -666,7 +666,14 @@ var InternalClient = (function () {
_this12.email = null;
_this12.password = null;
_this12.state = _ConnectionState2["default"].DISCONNECTED;
});
return Promise.resolve();
};
if (!this.user.bot) {
return this.apiRequest("post", _Constants.Endpoints.LOGOUT, true).then(disconnect);
} else {
disconnect();
}
};
// def startPM
@@ -1591,7 +1598,9 @@ var InternalClient = (function () {
return Promise.reject(new Error("Bitrate must be between 8-96kbps"));
}
data.bitrate *= 1000; // convert to bits before sending
if (data.bitrate) {
data.bitrate *= 1000; // convert to bits before sending
}
return _this35.apiRequest("patch", _Constants.Endpoints.CHANNEL(channel.id), true, data).then(function (res) {
channel.name = data.name;