 
   # TODO
   #   hubot pd escalation          - tells who is involved in the escalation process
-    robot.respond /pd escalation\s+$/, (res) ->
+    robot.respond /pd escalation\s+$/, 'pd_escalation', (res) ->
       res.send 'Not yet implemented'
       res.finish()
 
-  #   hubot pd me now            - creates an override until the end of current oncall
-    robot.respond /pd (?:([^ ]+) )?now\s*$/, (res) ->
-      [ _, who ] = res.match
-      pagerv2.setOverride(res.envelope.user, who, false)
-      .then (data) ->
-        res.send "Rejoice #{data.user.summary}! #{data.over.name} is now on call."
-      .catch (e) ->
-        res.send e
-      res.finish()
-
-  #   hubot pd not me            - cancels an override if any
-    robot.respond /pd not ([^ ]+)\s*$/, (res) ->
-      [ _, who ] = res.match
-      pagerv2.dropOverride(res.envelope.user, who)
-      .then (data) ->
-        res.send "Ok, #{res.envelope.user.name}! " +
-                 "#{data.overrides[0].user.summary} override is cancelled."
-      .catch (e) ->
-        res.send e
-      res.finish()
-
   #   hubot pd incident <number> - gives more information about incident number <number>
-    robot.respond /pd (?:inc |incident )(\d+|[A-Z0-9]{7})\s*$/, (res) ->
+    robot.respond /pd (?:inc |incident )(\d+|[A-Z0-9]{7})\s*$/, 'pd_incident', (res) ->
       [ _, incident ] = res.match
       pagerv2.getIncident(incident)
       .then (data) ->


  #   hubot pd assign [all] to me       - assigns all open incidents to caller
  #   hubot pd assign [all] to <user>   - assigns all open incidents to user
    robot.respond /pd assign(?: all) to (me|[^ ]+)\s*$/, (res) ->
      [ _, who ] = res.match
      if who is 'me'
        who = res.envelope.user.name

  #   hubot pd stfu|down [for] <duration> [because <reason>] - creates a maintenance
    robot.respond (
      /pd (?:stfu|down)(?: for)?\s*([0-9]+)?(?: min(?:utes)?)?(?: because (.+))?\s*$/
    ), 'pd_set_maintenance', (res) ->
      [ _, duration ] = res.match
      res.send 'Not yet implemented'
      res.finish()

  # TODO
  #   hubot pd up|end|back <maintenance> - ends <maintenance>
    robot.respond /pd (?:up|back|end) ([A-Z0-9]+)\s*$/, 'pd_end_maintenance', (res) ->
      [ _, maintenance ] = res.match
      res.send 'Not yet implemented'
      res.finish()

  # TODO
  #   hubot pd schedules [<search>]   - lists schedules (optionaly filtered by <search>)
    robot.respond /pd sched(?:ules?)?(?: ([A-Z0-9]+))?\s*$/, 'pd_schedules', (res) ->
      [ _, filter ] = res.match
      res.send 'Not yet implemented'
      res.finish()

  #   hubot pd me now            - creates an override until the end of current oncall
    robot.respond /pd (?:([^ ]+) )?now\s*$/, 'pd_override_now', (res) ->
      [ _, who ] = res.match
      pagerv2.setOverride(res.envelope.user, who, false)
      .then (data) ->
        res.send "Rejoice #{data.user.summary}! #{data.over.name} is now on call."
      .catch (e) ->
        res.send e
      res.finish()

  #   hubot pd not me            - cancels an override if any
    robot.respond /pd not ([^ ]+)\s*$/, 'pd_cancel_override', (res) ->
      [ _, who ] = res.match
      pagerv2.dropOverride(res.envelope.user, who)
      .then (data) ->
        res.send "Ok, #{res.envelope.user.name}! " +
                 "#{data.overrides[0].user.summary} override is cancelled."
      .catch (e) ->
        res.send e
      res.finish()

  #   hubot pd me <duration>     - creates an override for <duration> minutes
    robot.respond /pd (?:([^ ]+) )?(?:for )?(\d+)(?: min(?:utes)?)?\s*$/, 'pd_override', (res) ->
      [ _, who, duration ] = res.match
      pagerv2.setOverride(res.envelope.user, who, duration)
      .then (data) ->
