Reputation: 21
I'm trying to make hubot work with powershell. Hubot listens to the command (get service 'servicename' in this example), parces input and sends it to powershell.
module.exports = (robot) ->
robot.respond /get service (.*)$/i, (msg) ->
serviceName = msg.match[1]
psObject = {
serviceName: serviceName
}
callPowerShell = (psObject, msg)
This code works fine with one argument, but I don't know how to pass two arguments to hubot, for example, servicename and compname (get service 'servicename' 'compname').
Upvotes: 1
Views: 760
Reputation: 11
You should add one more brackets (.*) in respond or listen command. You can add as many as you wish, and also you can add brackets inside brackets. Just count them from the left and count them as 1st, 2nd ... and so on.
module.exports = (robot) ->
robot.respond /get service (.*) (.*)$/i, (msg) ->
serviceName = msg.match[1]
paramTwo = msg.match[2]
Upvotes: 1