From 36e7931b83f61aa553ef8b99e5adbde0667c26fd Mon Sep 17 00:00:00 2001 From: James Vega Date: Mon, 7 Jun 2004 05:17:50 +0000 Subject: [PATCH] A few small corrections --- plugins/FunDB.py | 5 +++-- test/test_FunDB.py | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/plugins/FunDB.py b/plugins/FunDB.py index ec6b23f1e..3bcfd7d96 100755 --- a/plugins/FunDB.py +++ b/plugins/FunDB.py @@ -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): """[] [] diff --git a/test/test_FunDB.py b/test/test_FunDB.py index 88887d8bd..5992a481c 100644 --- a/test/test_FunDB.py +++ b/test/test_FunDB.py @@ -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')