Question

I am trying to make Hubot detect when a user enters or leaves a channel, but so far I have been unable to actually find ANY information pertaining to this.

Does anyone have any ideas of how to do this? :)

Thanks in advance!

Was it helpful?

Solution

Hubot's Robot class has functions enter and leave that will fire a callback you give when any user enters or leaves the room. That callback takes a Response, which has a property message of type Message, which in turn has a property user of type User.

module.exports = (robot) ->
   robot.enter (response) ->
     # at this point you can get the user's name with:
     # response.message.user.name
     # works the same for robot.leave

However, it appears that the IRC adapter for hubot doesn't currently fire the messages needed to get those functions to work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top