Skip to content

Commit 6746649

Browse files
committed
fixing to support the new hubot-slack plugin
1 parent 64f80bf commit 6746649

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

Diff for: package.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "hubot-stackstorm-auth",
33
"description": "A hubot plugin for integrating with StackStorm event-driven infrastructure automation platform with role based auth.",
4-
"version": "0.1.2",
4+
"version": "1.0.1",
55
"author": "Silver Blueprints, LLC. <[email protected]>",
66
"license": "Apache-2.0",
77
"keywords": [
@@ -27,9 +27,7 @@
2727
"rsvp": "3.0.14",
2828
"st2client": "^0.4.3",
2929
"truncate": "^1.0.4",
30-
"node-uuid": "~1.4.0",
31-
"mongodb": "^2.0.52",
32-
"mongodb-url": "^1.0.3"
30+
"node-uuid": "~1.4.0"
3331
},
3432
"peerDependencies": {
3533
"hubot": "2.x"

Diff for: src/lib/messaging_handler/slack.js

+2-14
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,6 @@ var DefaultMessagingHandler = require('./default');
99
function SlackMessagingHandler(robot) {
1010
var self = this;
1111
DefaultMessagingHandler.call(this, robot);
12-
13-
var sendMessageRaw = function(message) {
14-
/*jshint validthis:true */
15-
message['channel'] = this.id;
16-
message['parse'] = 'none';
17-
this._client._send(message);
18-
};
19-
20-
if (robot.adapter && robot.adapter.constructor && robot.adapter.constructor.name === 'SlackBot') {
21-
for (var channel in robot.adapter.client.channels) {
22-
robot.adapter.client.channels[channel].sendMessage = sendMessageRaw.bind(robot.adapter.client.channels[channel]);
23-
}
24-
}
2512
}
2613

2714
util.inherits(SlackMessagingHandler, DefaultMessagingHandler);
@@ -80,9 +67,10 @@ SlackMessagingHandler.prototype.postData = function(data) {
8067
};
8168

8269
SlackMessagingHandler.prototype.normalizeAddressee = function(msg) {
70+
var room_name = robot.adapter.client.rtm.dataStore.getChannelById(msg.message.room).name
8371
return {
8472
name: msg.message.user.name,
85-
room: msg.message.room
73+
room: room_name
8674
};
8775
};
8876

0 commit comments

Comments
 (0)