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