![](/img/trans.png)
[英]Is there a way to make Hubot reply to all messages that are not existing commands?
[英]Make Hubot run preconfigured commands automatically
我在flowdock上使用Hubot,我试图让Hubot自动发布用户命令的响应。
在https://leanpub.com/automation-and-monitoring-with-hubot/read#leanpub-auto-periodic-task-execution的帮助下,我成功地在特定的时间让Hubot谈话创建了一个cron。咖啡脚本,所以没有问题。
问题是我有另一个脚本( trello.coffee )使Hubot响应命令“show cards”,我希望在特定时间发布此命令的结果,而不需要告诉Hubot这样做。
如果不需要编写另一个脚本(即trello.auto.coffee )和整个robot.emit - > robot.on程序,我究竟能做到这一点?
那么使用http监听器呢? 此页面有一个HTTP Listener部分,并有以下代码示例:
module.exports = (robot) ->
robot.router.post '/hubot/chatsecrets/:room', (req, res) ->
room = req.params.room
data = if req.body.payload? then JSON.parse req.body.payload else req.body
secret = data.secret
robot.messageRoom room, "I have a secret: #{secret}"
res.send 'OK'
那会有用吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.