hubot-archive / hubot-standup-alarm

Use Hubot to remind your team to do your standups

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doesn't understand IRC rooms

docwhat opened this issue · comments

When using it with the IRC adapter, it doesn't seem to understand IRC rooms (aka channels).

IRC channels are of the form #foobar.

Example output:

[11:23:53] @docwhat:     hubot list standups in every room
[11:23:53] hubot:    Here's the standups for every room:
[11:23:53] hubot:    Room: undefined, Time: 10:00
[11:23:53] hubot:    Room: undefined, Time: 11:45

I haven't hit 11:45am yet, so we'll see if it triggers or not.

Hi - take a look at #2, the proposed fix should also remedy the problem you're having.

@shaundon I don't see any proposal there... but I see that you're using msg.envelope.user.reply_to instead of msg.envelope.user.room to get the room. If I use 'room' then it works.

The proposal was this part:

If you can hold on a few days, I'll find out how flowdock does this, extract getting the room name to a function that takes the chat app you're using as an argument, and then have that placed in an environment variable so you can set your environment and everything should just work, hopefully! (or feel free to do that and PR it 😄)

So I'm going to have a function called getRoom or similar, which takes an argument of the type of adapter you're using, e.g. IRC, Flowdock, HipChat, and then returns the room with the correct method for that adapter. An environment variable can be used to set the adapter, so that you won't need to edit the code itself.

Doesn't hubot handle this for you via the .room attributes?

Not to my knowledge - it didn't work with Hipchat - but I'll look into it some more, as obviously that would be preferable.

With HipChat at least, the issue was that the room passed to robot.messageRoom wasn't in a format that the function understood, e.g. msg.envelope.user.room returned something like myroomone, but that didn't work when calling robot.messageRoom. However, msg.envelope.user.reply_to returned something like myroomone_07869745684@room.hipchat.com, which robot.messageRoom accepted.

It's strange I know..

Wow. You can't be the only person to have done this. I got the room stuff from something in the catalog.

I'll check it out as soon as I can, hopefully this week sometime, and then get back to you with (hopefully) a proper solution 😄

I have a pull request open for a similar room name problem, in case that helps https://github.com/hubot-scripts/hubot-standup-alarm/pulls/6

That looks correct. Cool!

Closing this, as it was fixed in d360805.