     )
   )
 
-  bot.rs.reply(input).then (reply) ->
+  bot.rs.reply(bot.username, input).then (reply) ->
     test.equal(reply, "hello there stranger with a delay")
     test.done()

exports.test_promises_in_objects = (test) ->
  bot = new TestCase(test, """
    + *
    - hello there <call>helper <star></call> with a <call>anotherHelper</call>
  """)

  input = "hello there"

  bot.rs.setSubroutine("helper", (rs, args) ->
    return new Promise((resolve, reject) -> 
      resolve("stranger")
    )
  )

  bot.rs.setSubroutine("anotherHelper", (rs, args) ->
    return new Promise((resolve, reject) -> 
      setTimeout () ->
        resolve("delay")


exports.test_function_in_setSubroutine = (test) ->
  bot = new TestCase(test, """
    + my name is *
    - hello person<call>helper <star></call>
  """)

  input = "my name is Rive"

  bot.rs.setSubroutine("helper", (rs, args) ->
    test.ok(args.length is 1)
    test.equal(rs, bot.rs)
    test.equal(args[0], "rive")
    test.done()
  )

