mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-29 21:54:22 +01:00
Included plugins.standardSubstitute in factoids parsing now
This commit is contained in:
parent
68d36db874
commit
96f299c10c
@ -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("<action>", "", 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":
|
||||
|
@ -53,6 +53,9 @@ if sqlite is not None:
|
||||
self.assertResponse('foo', 'foo is foo')
|
||||
self.assertNotError('bar is <reply>moo is moo')
|
||||
self.assertResponse('bar', 'moo is moo')
|
||||
# Check substitution
|
||||
self.assertNotError('who is <reply>$who')
|
||||
self.assertResponse('who', 'foo')
|
||||
|
||||
def testLiteral(self):
|
||||
self.assertError('literal moo') # no factoids yet
|
||||
|
Loading…
Reference in New Issue
Block a user