 module.exports = (robot) ->
   statusEmoji = new StatusEmoji
 
+  brewing = {}
+  robot.brain.on 'loaded', =>
+    robot.brain.data.coffee ?= { brewing: {} }
+    brewing = robot.brain.data.coffee.brewing ?= {}
+
+  coffeeconomy = new Coffeeconomy robot
+
   robot.respond /coffee (\d+)$/i, (msg) ->
     cups = msg.match[1]
 


    msg.send "You need #{scoops} level scoops and #{water} L of water."

  brewing = {}

  robot.respond /brewing\s*$/i, (msg) ->
    if isBrewing()

      dibs: [barista],
      messageMetadata: msg.envelope.message.metadata,

    robot.brain.save()

    msg.send "@team Brew started by @#{brewing.barista}! #{statusEmoji.random('success')}\n" +
      "To grab a spot use: #{robot.alias}dibs\n" +
      "To end the brew use: #{robot.alias}fresh pot"
