Fixed a bug where addFactoid wasn't splitting on the first "is"

This commit is contained in:
Daniel DiPaolo 2003-11-01 22:08:52 +00:00
parent 1d1d7a87c2
commit 82d2d8162a
2 changed files with 3 additions and 1 deletions

View File

@ -212,7 +212,7 @@ class MoobotFactoids(callbacks.PrivmsgCommandAndRegexp):
return True
def addFactoid(self, irc, msg, match):
r"^(.+)\s+(?:is|_is_)\s+(.+)"
r"^(.+?)\s+(?:is|_is_)\s+(.+)"
# First, check and see if the entire message matches a factoid key
cursor = self.db.cursor()
cursor.execute("""SELECT * FROM factoids WHERE key LIKE %s""",

View File

@ -51,6 +51,8 @@ if sqlite is not None:
self.assertError('moo!? is foo') # 'moo' already exists
self.assertNotError('foo!? is foo')
self.assertResponse('foo', 'foo is foo')
self.assertNotError('bar is <reply>moo is moo')
self.assertResponse('bar', 'moo is moo')
def testLiteral(self):
self.assertError('literal moo') # no factoids yet