mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Added get channel logs
This commit is contained in:
@@ -194,6 +194,29 @@ var Client = (function (_EventEmitter) {
|
||||
});
|
||||
};
|
||||
|
||||
// def getChannelLogs
|
||||
|
||||
Client.prototype.getChannelLogs = function getChannelLogs(where) {
|
||||
var limit = arguments.length <= 1 || arguments[1] === undefined ? 500 : 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];
|
||||
|
||||
var self = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
if (typeof options === "function") {
|
||||
// options is the callback
|
||||
callback = options;
|
||||
}
|
||||
self.internal.getChannelLogs(where, limit, options).then(function (logs) {
|
||||
callback(null, logs);
|
||||
resolve(logs);
|
||||
})["catch"](function (e) {
|
||||
callback(e);
|
||||
reject(e);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return Client;
|
||||
})(EventEmitter);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user