           achieved: 0
         }
         goals = robot.brain.data.goals[@.user].goals.concat _goals
+        expiration = moment()
+          .set("date", moment().get("date") + 1)
+          .startOf("day").set("hour", 3)
 
         _.extend robot.brain.data.goals[@.user], {
           goals: goals
           attempted: robot.brain.data.goals[@.user].attempted + _goals.length
+          expiration: expiration.format()
         }
         msg.send "ありがとうございました。現在設定中の目標は\n" +
           (_.map goals, (goal, i) ->

        attempted: 0
        achieved: 0
      }
    _.extend robot.brain.data.goals[user], {
      expiration: expiration.format()
      goal: goal
      attempted: robot.brain.data.goals[user].attempted + 1
    }

    msg.send "OK。#{user}さんの今日の目標は「#{goal}」ですね。"

  robot.respond /今日の目標は(？)?$/i, (msg) ->
    user = msg.envelope.user.name
    data = robot.brain.data.goals[user] or null

    unless data and moment(data.expiration).isAfter moment()
      msg.send "#{user}さんの今日の目標は設定されておりません。"
      return
    msg.send "#{user}さんの今日の目標は「#{data.goal}」です。"

  robot.respond /.*目標達成.*/i, (msg) ->
    user = msg.envelope.user.name
    data = robot.brain.data.goals[user] or null

    unless data and moment(data.expiration).isAfter moment()
      msg.send "#{user}さん、今日は目標設定してないですよ。"
      return
    robot.brain.data.goals[user].achieved += 1
    robot.brain.data.goals[user].expiration = moment().format()
    msg.send "#{user}さんの目標は。。。\n「#{data.goal}」ですね。\n" +
      msg.random congraturations

  robot.respond /.*達成度.*/i, (msg) ->
    user = msg.envelope.user.name


module.exports = (robot) ->

  robot.brain.on "loaded", ->
    robot.brain.data.goals = {} unless robot.brain.data.goals?

  congraturations = [
    "目標達成おめでとうございます！"
