klarna / hubot-stash-poll

Poll your Atlassian Stash repositories for pull request changes
Other
10 stars 2 forks source link

Problem when using with the slack adapter #14

Open tayzlor opened 9 years ago

tayzlor commented 9 years ago

When using this in conjunction with the slack adapter im receiving the following error -

] ERROR TypeError: Cannot call method 'send' of undefined at SlackBot.send (/node_modules/hubot-slack/src/slack.coffee:181:16, <js>:216:33) at Robot.messageRoom (//node_modules/hubot/src/robot.coffee:415:19, <js>:379:42) at sendRoomMessages (/node_modules/hubot-stash-poll/src/scripts/bot.coffee:84:7, <js>:73:29) at EventEmitter.<anonymous> (/node_modules/hubot-stash-poll/src/scripts/bot.coffee:92:5, <js>:81:14) at EventEmitter.emit (events.js:95:17) at Poller._upsertPullrequests (/node_modules/hubot-stash-poll/src/utils/poller.coffee:132:31, <js>:167:35) at /node_modules/hubot-stash-poll/src/utils/poller.coffee:71:15, <js>:91:21 at IncomingMessage.<anonymous> (/node_modules/hubot/node_modules/scoped-http-client/src/index.js:80:22) at IncomingMessage.emit (events.js:117:20) at _stream_readable.js:929:16 at process._tickCallback (node.js:419:13)

These are the versions im using -

 "engines": {
    "node": ">= 0.8.x",
    "npm": ">= 1.1.x"
  }
dependencies": {
    "hubot": ">= 2.6.0 < 3.0.0",
    "hubot-slack": "~3.2.1",
    "hubot-stash-poll": "0.0.3"

This looks like it is because hubot-stash-poll is using the channel ID instead of the channel name to send the message, and in hubot-slack it tries to retrieve the channel by name -

channel = @client.getChannelGroupOrDMByName envelope.room

tayzlor commented 9 years ago

In add.coffee and rm.coffee this works (in tryUnregister tryRegister functions) -

-  roomHandle = format.room.handle(msg)
+  roomHandle = msg.message.user.room
cskeppstedt commented 9 years ago

@tayzlor thanks for the report, I have to check if this affects the other adapters (I did a fix a while back for this, but it was the hipchat adapter that was broken).