Browse Source

[bugfix] rtm must use remote id

B Thibault 8 years ago
parent
commit
fc7253ab59
1 changed files with 4 additions and 4 deletions
  1. 4 4
      srv/src/slack.js

+ 4 - 4
srv/src/slack.js

@@ -234,8 +234,8 @@ Slack.prototype.onMessage = function(msg, t) {
     }
     this.data.onMessage(msg, t);
     if ((msg["channel"] || msg["channel_id"] || (msg["item"] && msg["item"]["channel"])) && msg["type"] && UPDATE_LIVE.indexOf(msg["type"]) !== -1) {
-        var channelId = this.data.team.id +(msg["channel"] || msg["channel_id"] || msg["item"]["channel"])
-            ,channel = this.data.channels[msg["channel"]]
+        var channelId = this.data.team.id +'|' +(msg["channel"] || msg["channel_id"] || msg["item"]["channel"])
+            ,channel = this.data.channels[channelId]
             ,histo = this.history[channelId];
         if (histo) {
             var lastMsg = histo.push(msg, t);
@@ -486,8 +486,8 @@ Slack.prototype.sendMsg = function(channel, text, attachments) {
         var fullDecodedText = decodedText.join("\n");
         this.pendingRtm[this.rtmId] = {
             type: 'message',
-            channel: channel.id,
-            user: this.data.self.id,
+            channel: channel.remoteId,
+            user: this.data.self.remoteId,
             text: fullDecodedText
         };
         this.rtm.send('{"id":' +this.rtmId++ +',"type":"message","channel":"' +channel.remoteId +'", "text":' +JSON.stringify(fullDecodedText) +'}');