     msg.send "Error: jenkins plugin not installed."
     return
 
-  environment = querystring.escape msg.match[1]
-  branch = querystring.escape msg.match[2]
+  environment = querystring.escape msg.match[2]
+  branch = querystring.escape msg.match[3]
   user = msg.message.user
 
   if environment not of CONFIG


  job = CONFIG[environment].job
  role = CONFIG[environment].role
  params = "BRANCH=#{branch}"

  if not userHasRole(user, role)
     msg.send "Access denied."


querystring = require 'querystring'

CONFIG = JSON.parse process.env.HUBOT_DEPLOY_CONFIG

jenkinsDeploy = (msg, robot) ->

  userHasRole = (user, role) ->
    if role is "*"
