Browse Source

[bugfix] first was already working

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

+ 8 - 18
srv/src/slack.js

@@ -111,24 +111,14 @@ Slack.prototype.connect = function(cb) {
 };
 
 Slack.prototype.sendCommand = function(room, cmd, arg) {
-    if (cmd.name === "/away") {
-        // intercept away commands
-        // TODO should be idempotent
-        httpsRequest(
-            SLACK_ENDPOINT
-            +GETAPI.setPresence
-            +"?token=" +this.token
-            +"&presence=" +(this.data.self.presence ? "away": "auto"));
-    } else {
-        httpsRequest(
-            SLACK_ENDPOINT
-            +GETAPI.slashExec
-            +"?token=" +this.token
-            +"&command=" +encodeURIComponent(cmd.name)
-            +"&disp=" +encodeURIComponent(cmd.name)
-            +"&channel=" +room.remoteId
-            +"&text=" +arg);
-    }
+    httpsRequest(
+        SLACK_ENDPOINT
+        +GETAPI.slashExec
+        +"?token=" +this.token
+        +"&command=" +encodeURIComponent(cmd.name)
+        +"&disp=" +encodeURIComponent(cmd.name)
+        +"&channel=" +room.remoteId
+        +"&text=" +arg);
 }
 
 Slack.prototype.sendTyping = function(room) {