     else 
       "No factoid for #{key}. It can't also be #{val} if it isn't already something."
 
+  setFactoid: (key, val) ->
+    @cache[key] = val
+    @robot.brain.data.factoids = @cache
+    "OK. #{key} is #{val} "
+
   niceGet: (key) ->
-    @cache[key] or "No factoid for #{key}"
+    this.get key or "No factoid for #{key}"
 
   get: (key) ->
     @cache[key]

# ~tell <user> about <factoid> - Tells the user about a factoid, if it exists.
# ~~<user> <factoid> - Same as ~tell, less typing.
# <factoid>? - Same as ~<factiod> except for there is no response if not found.

class Factoids
  constructor: (@robot) ->

    factoid = factoids.get msg.match[1]
    if factoid
      msg.reply msg.match[1] + " is " + factoid

  robot.respond /no, (.+) is (.+)/i, (msg) ->
    msg.reply factoids.setFactoid match[1], match[2]
