A few small corrections

This commit is contained in:
James Vega 2004-06-07 05:17:50 +00:00
parent dcd5606b6c
commit 36e7931b83
2 changed files with 26 additions and 2 deletions

View File

@ -344,9 +344,10 @@ class FunDB(callbacks.Privmsg, plugins.ChannelDBHandler):
(id, insult) = cursor.fetchone()
nick = re.sub(r'\bme\b', msg.nick, nick)
nick = re.sub(r'\bmy\b', '%s\'s' % msg.nick, nick)
insult = insult.replace('$who', nick)
insult = '%s: %s' % (nick, insult.replace('$who', nick))
showid = self.registryValue('showIds', channel)
irc.reply(self._formatResponse(insult, id, showid), to=nick)
irc.reply(self._formatResponse(insult, id, showid),
prefixName=False)
def excuse(self, irc, msg, args):
"""[<channel>] [<id>]

View File

@ -145,6 +145,29 @@ if sqlite is not None:
self.assertRegexp('stats insult', 'currently 0')
self.assertError('insult jemfinch')
def testChannelReplies(self):
self.assertNotError('add #tester praise pets $who')
self.assertNotError('add praise pats $who')
self.assertNotError('add #tester lart stabs $who')
self.assertNotError('add lart stubs $who')
self.assertNotError('add #tester insult nimrod')
self.assertNotError('add insult nimwit')
self.assertNotError('add #tester excuse He did it!')
self.assertNotError('add excuse She did it!')
self.assertResponse('praise jemfinch',
'\x01ACTION pats jemfinch (#1)\x01')
self.assertResponse('praise #tester jemfinch',
'\x01ACTION pets jemfinch (#1)\x01')
self.assertResponse('lart jemfinch',
'\x01ACTION stubs jemfinch (#1)\x01')
self.assertResponse('lart #tester jemfinch',
'\x01ACTION stabs jemfinch (#1)\x01')
self.assertResponse('insult jemfinch', 'jemfinch: nimwit (#1)')
self.assertResponse('insult #tester jemfinch',
'jemfinch: nimrod (#1)')
self.assertResponse('excuse', 'She did it! (#1)')
self.assertResponse('excuse #tester', 'He did it! (#1)')
def testPraise(self):
self.assertNotError('add praise pets $who')
self.assertHelp('praise')