 #
 # Commands:
 #   hubot when you hear <pattern> do <something hubot does> - Setup a ear dropping event
+#   hubot when you hear <pattern> do 1|<something hubot does>; 2|<some.... - Set up ear dropping with multiple actions and ordering
 #   hubot stop ear dropping - Stop all ear dropping
 #   hubot stop ear dropping on <pattern> - Remove a particular ear dropping event
 #   hubot show ear dropping - Show what hubot is ear dropping on

  robot.hear /(.+)/i, (msg) ->
    robotHeard = msg.match[1]

    for task in earDropping.all()
      if new RegExp(task.key, "i").test(robotHeard)
        if (robot.name != msg.message.user.name && !(new RegExp("^#{robot.name}", "i").test(robotHeard)))
          robot.receive new TextMessage(msg.message.user, "#{robot.name}: #{task.task}")


  robot.respond /when you hear (.+?) do (.+?)$/i, (msg) ->
    key = msg.match[1]
    for task_raw in msg.match[2].split ";"
      task_split = task_raw.split "|"
      earDropping.add(key, task_split[1], task_split[0])
    msg.send "I am now ear dropping for #{key}. Hehe."

  robot.respond /stop ear *dropping$/i, (msg) ->
