 #   Tell Hubot to send a user a message when present in the room
 #
 # Dependencies:
-#   timeago
+#   timeago (if HUBOT_TELL_RELATIVE_TIME is set)
 #
 # Configuration:
 #   HUBOT_TELL_ALIASES [optional] - Comma-separated string of command aliases for "tell".
+#   HUBOT_TELL_RELATIVE_TIME [boolean] - Set to use relative time strings ("2 hours ago")
 #
 # Commands:
 #   hubot tell <recipients> <some message> - tell <recipients> <some message> next time they are present.

        if username.match(new RegExp("^#{recipient}"), "i")
          tellmessage = "#{username}: "
          for message in localstorage[room][recipient]
            timestr = timeago(message[1])
            tellmessage += "#{message[0]} said #{timestr}: #{message[2]}\r\n"
          delete localstorage[room][recipient]
          msg.send(tellmessage)


  # When a user enters, check if someone left them a message
  robot.enter (msg) ->
    if config.relativeTime
      timeago = require('timeago')
    username = msg.message.user.name
    room = msg.message.user.room
    if localstorage[room]?
