Added get channel logs

This commit is contained in:
hydrabolt
2015-10-31 23:58:47 +00:00
parent 3c16a9f2a4
commit 53ef5df10d
6 changed files with 154 additions and 6 deletions

View File

@@ -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);