 
     msg.send message
 
-  robot.hear /thx/i, (msg) ->
-    msg.send "#{msg.message.user.name}: hey, grant a plus!"
-

module.exports = (robot) ->
  robot.brain.data.achievements ||= {}

  robot.hear /(.*): *\+1 for (.*)$/i, (msg) ->
    receiver = msg.match[1]
    thanking = msg.message.user.name
    reason   = msg.match[2]

    if receiver == thanking
      msg.send "hey, don't cheat!"


  robot.respond /who thanks me??/i, (msg) ->
    user = msg.message.user.name
    response = "#{user}, #{robot.brain.data.achievements[user].length} time(s) someone thanked you:\n"
    for achievement in robot.brain.data.achievements[user]
      response += "#{achievement.given_by} for #{achievement.reason}\n"
    msg.send response
