简体   繁体   English

如何找到Hubot响应的房间名称?

[英]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. 我正在写一个Hubot脚本来连接我们的跟踪系统。 It should be triggering a PHP script with various parameters, and then that script will send the response into the room. 它应该触发带有各种参数的PHP脚本,然后该脚本将响应发送到房间。

How can I tell which room the message that Hubot is responding to came from, so I can send it in my AJAX request? 我怎么知道Hubot响应的消息来自哪个房间,所以我可以在我的AJAX请求中发送它?

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

这就是你得到房间的方式:

room = msg.message.room

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM