Ver código fonte

[add] slack history

B Thibault 8 anos atrás
pai
commit
0091e1667f
1 arquivos alterados com 3 adições e 2 exclusões
  1. 3 2
      srv/src/slack.js

+ 3 - 2
srv/src/slack.js

@@ -598,7 +598,7 @@ Slack.prototype.editMsg = function(channel, msgId, text) {
 /**
  * @param {SlackChan|SlackGroup|SlackIms} target
 **/
-Slack.prototype.fetchHistory = function(target, cb) {
+Slack.prototype.fetchHistory = function(target, cb, count) {
     var _this = this
         ,baseUrl = ""
         ,targetId = target.remoteId;
@@ -613,9 +613,10 @@ Slack.prototype.fetchHistory = function(target, cb) {
     httpsRequest(baseUrl
         +"?token="+this.token
         +"&channel=" +targetId
-        +"&count=" +HISTORY_LENGTH,
+        +"&count=" +(count || 100),
     (status, resp) => {
         var history = [];
+        console.log(count || 100);
         if (status === 200 && resp && resp.ok) {
             var histo = this.history[target.id];
             if (!histo)