From c78f37dcbfa9dba60df180fe7da2e82bd48c2418 Mon Sep 17 00:00:00 2001 From: Enrico Fasoli Date: Fri, 24 Apr 2015 10:58:29 +0200 Subject: [PATCH] cancellare la memoria ora possibile --- scripts/memoria.coffee | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/memoria.coffee b/scripts/memoria.coffee index 05d89cd..95df8b7 100644 --- a/scripts/memoria.coffee +++ b/scripts/memoria.coffee @@ -8,6 +8,13 @@ module.exports = (robot) -> res.send 'non sapevo che '+name+' fosse '+definition+'. Me lo ricorderò' mem[name] = definition robot.brain.set 'memoria', mem + robot.respond /dimentica(?:ti)? (.+)/i, (res) -> + mem = robot.brain.get('memoria') or {} + if mem[res.match[1]]? + res.send 'cancellazione neuronale in corso...' + delete mem[res.match[1]] + robot.brain.set 'memoria', mem # necessary? + else res.send 'non so cosa sia' robot.respond /(?:che )?cos(?:\')?è (.+)/i, (res) -> mem = robot.brain.get('memoria') or {} if mem[res.match[1]]