For some reason I was replacing the bot's name with the user's name

This commit is contained in:
James Vega 2003-10-31 18:43:08 +00:00
parent 8c93488146
commit d50d435363
2 changed files with 21 additions and 14 deletions

View File

@ -154,7 +154,7 @@ class FunDB(callbacks.Privmsg):
else:
(id, insult) = cursor.fetchone()
nick = nick.strip()
nick = re.sub(r'\b(?:me|%s)\b' % irc.nick, msg.nick, nick)
nick = re.sub(r'\bme\b', msg.nick, nick)
nick = re.sub(r'\bmy\b', '%s\'s' % msg.nick, nick)
insultee = nick
insult = insult.replace("$who", insultee)
@ -426,8 +426,8 @@ class FunDB(callbacks.Privmsg):
irc.error(msg, 'There are currently no available larts.')
else:
(id, lart) = cursor.fetchone()
nick = re.sub(r'\b(?:me|%s)\b' % irc.nick, msg.nick, nick)
reason = re.sub(r'\b(?:me|%s)\b' % irc.nick, msg.nick, reason)
nick = re.sub(r'\bme\b', msg.nick, nick)
reason = re.sub(r'\bme\b', msg.nick, reason)
nick = re.sub(r'\bmy\b', '%s\'s' % msg.nick, nick)
reason = re.sub(r'\bmy\b', '%s\'s' % msg.nick, reason)
lartee = nick
@ -478,8 +478,8 @@ class FunDB(callbacks.Privmsg):
irc.error(msg, 'There are currently no available praises.')
else:
(id, praise) = cursor.fetchone()
nick = re.sub(r'\b(?:me|%s)\b' % irc.nick, msg.nick, nick)
reason = re.sub(r'\b(?:me|%s)\b' % irc.nick, msg.nick, reason)
nick = re.sub(r'\bme\b', msg.nick, nick)
reason = re.sub(r'\bme\b', msg.nick, reason)
nick = re.sub(r'\bmy\b', '%s\'s' % msg.nick, nick)
reason = re.sub(r'\bmy\b', '%s\'s' % msg.nick, reason)
praisee = nick

View File

@ -38,7 +38,12 @@ except ImportError:
if sqlite is not None:
class TestFunDB(PluginTestCase, PluginDocumentation):
plugins = ('FunDB',)
plugins = ('FunDB','User','Utilities')
def setUp(self):
PluginTestCase.setUp(self)
self.prefix = 't3st!bar@foo.com'
self.assertNotError('register t3st moo')
def testAdd(self):
self.assertError('add l4rt foo')
@ -74,24 +79,26 @@ if sqlite is not None:
self.assertNotError('add lart jabs $who')
self.assertNotError('add praise pets $who')
self.assertNotError('add insult foo')
self.assertRegexp('lart me', 'jabs test \(#1\)')
self.assertRegexp('praise me', 'pets test \(#1\)')
self.assertRegexp('insult me', 'test: foo \(#1\)')
self.assertRegexp('lart me', 'jabs t3st \(#1\)')
self.assertRegexp('praise me', 'pets t3st \(#1\)')
self.assertRegexp('insult me', 't3st: foo \(#1\)')
self.assertRegexp('lart whamme', 'jabs whamme \(#1\)')
self.assertRegexp('praise whamme', 'pets whamme \(#1\)')
self.assertRegexp('insult whamme', 'whamme: foo \(#1\)')
self.assertRegexp('lart my knee', 'jabs test\'s knee \(#1\)')
self.assertRegexp('praise my knee', 'pets test\'s knee \(#1\)')
self.assertRegexp('insult my knee', 'test\'s knee: foo \(#1\)')
self.assertRegexp('lart my knee', 'jabs t3st\'s knee \(#1\)')
self.assertRegexp('praise my knee', 'pets t3st\'s knee \(#1\)')
self.assertRegexp('insult my knee', 't3st\'s knee: foo \(#1\)')
self.assertRegexp('lart sammy the snake', 'jabs sammy the snake'\
' \(#1\)')
self.assertRegexp('praise sammy the snake', 'pets sammy the snake'\
' \(#1\)')
self.assertRegexp('insult sammy the snake', 'sammy the snake: foo'\
' \(#1\)')
self.assertRegexp('lart me for my', 'jabs test for test\'s \(#1\)')
self.assertRegexp('praise me for my','pets test for test\'s '\
self.assertRegexp('lart me for my', 'jabs t3st for t3st\'s \(#1\)')
self.assertRegexp('praise me for my', 'pets t3st for t3st\'s '\
'\(#1\)')
self.assertRegexp('lart me and %s' % self.irc.nick, 'jabs t3st '\
'and %s \(#1\)' % self.irc.nick)
self.assertNotError('remove lart 1')
self.assertNotError('remove praise 1')
self.assertNotError('remove insult 1')