diff --git a/plugins/MoobotFactoids.py b/plugins/MoobotFactoids.py index 2740f2f96..3d4027335 100644 --- a/plugins/MoobotFactoids.py +++ b/plugins/MoobotFactoids.py @@ -159,7 +159,7 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp): self.db.close() del self.db - def parseFactoid(self, fact): + def parseFactoid(self, irc, msg, fact): type = "define" # Default is to just spit the factoid back as a # definition of what the key is (i.e., "foo is bar") newfact = ''.join(pick(tokenize(fact))) @@ -171,6 +171,7 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp): newfact = newfact.replace("", "", 1) newfact = newfact.strip() type = "action" + newfact = plugins.standardSubstitute(irc, msg, newfact) return (type, newfact) def updateFactoidRequest(self, key, hostmask): @@ -200,7 +201,7 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp): hostmask = msg.prefix self.updateFactoidRequest(key, hostmask) # Now actually get the factoid and respond accordingly - (type, text) = self.parseFactoid(fact) + (type, text) = self.parseFactoid(irc, msg, fact) if type == "action": irc.queueMsg(ircmsgs.action(ircutils.replyTo(msg), text)) elif type == "reply": diff --git a/test/test_MoobotFactoids.py b/test/test_MoobotFactoids.py index 5e5496778..bbf9f9061 100644 --- a/test/test_MoobotFactoids.py +++ b/test/test_MoobotFactoids.py @@ -53,6 +53,9 @@ if sqlite is not None: self.assertResponse('foo', 'foo is foo') self.assertNotError('bar is moo is moo') self.assertResponse('bar', 'moo is moo') + # Check substitution + self.assertNotError('who is $who') + self.assertResponse('who', 'foo') def testLiteral(self): self.assertError('literal moo') # no factoids yet