mirror of
https://github.com/discordjs/discord.js.git
synced 2026-06-04 10:00:08 +00:00
Handle unavailable guild, fix default getChannelLogs limit
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user