Handle unavailable guild, fix default getChannelLogs limit

This commit is contained in:
abalabahaha
2016-01-18 17:46:15 -08:00
parent 94f067cc51
commit 68435f0619
6 changed files with 65 additions and 70 deletions

View File

@@ -86,7 +86,7 @@ var Client = (function (_EventEmitter) {
var callback = arguments.length <= 0 || arguments[0] === undefined ? function () /*err, {}*/{} : arguments[0];
this.internal.logout().then(function () {
return this.internal.logout().then(function () {
return _this.internal.disconnected(true);
}).then(dataCallback(callback), errorCallback(callback));
};
@@ -179,7 +179,7 @@ var Client = (function (_EventEmitter) {
// def getChannelLogs
Client.prototype.getChannelLogs = function getChannelLogs(where) {
var limit = arguments.length <= 1 || arguments[1] === undefined ? 500 : arguments[1];
var limit = arguments.length <= 1 || arguments[1] === undefined ? 50 : arguments[1];
var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
var callback = arguments.length <= 3 || arguments[3] === undefined ? function () /*err, logs*/{} : arguments[3];
@@ -187,6 +187,10 @@ var Client = (function (_EventEmitter) {
// options is the callback
callback = options;
options = {};
} else if (typeof limit === "function") {
// options is the callback
callback = limit;
limit = 50;
}
return this.internal.getChannelLogs(where, limit, options).then(dataCallback(callback), errorCallback(callback));