Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I find the name of the room Hubot is responding to?

I'm writing a Hubot script to connect with our tracking system at work. It should be triggering a PHP script with various parameters, and then that script will send the response into the room.

How can I tell which room the message that Hubot is responding to came from, so I can send it in my AJAX request?

This is what my script looks like:

module.exports = (robot) ->

robot.hear /RT \d+$/, (msg) ->
    ticket = msg.match[1]

    msg.send "test"

    $.ajax 'YourScriptHere',
          data :
            room : room // This is what I need to find.
            ticket : ticket
like image 819
Ben Craig Avatar asked Jul 02 '14 20:07

Ben Craig


1 Answers

This is how you get the room:

room = msg.message.room

like image 144
Spajus Avatar answered Oct 17 '22 06:10

Spajus