mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Changed to use callbacks.reply again, now that we have the prefixName option.
This commit is contained in:
parent
9d8aa07f86
commit
43fbbb9b70
@ -41,30 +41,30 @@ import ircmsgs
|
||||
import ircutils
|
||||
import callbacks
|
||||
|
||||
def reply(msg, s):
|
||||
return ircmsgs.privmsg(ircutils.replyTo(msg), s)
|
||||
|
||||
class Friendly(callbacks.PrivmsgRegexp):
|
||||
def greet(self, irc, msg, match):
|
||||
r"(?:heya?|(?:w(?:hat'?s\b|as)s?up)|howdy|hi|hello)"
|
||||
if irc.nick in msg.args[1]:
|
||||
irc.queueMsg(reply(msg, 'howdy, %s :)' % msg.nick))
|
||||
s = 'howdy, %s :)' % msg.nick
|
||||
irc.queueMsg(callbacks.reply(msg, s, prefixName=False))
|
||||
|
||||
def goodbye(self, irc, msg, match):
|
||||
r"(?:good)?bye|adios|vale|ciao|au revoir|seeya|night"
|
||||
if irc.nick in msg.args[1]:
|
||||
irc.queueMsg(reply(msg, 'seeya, %s!' % msg.nick))
|
||||
s = 'seeya, %s!' % msg.nick
|
||||
irc.queueMsg(callbacks.reply(msg, s, prefixName=False))
|
||||
|
||||
def exclaim(self, irc, msg, match):
|
||||
r"^([^\s]+)!"
|
||||
if match.group(1) == irc.nick:
|
||||
irc.queueMsg(reply(msg, '%s!' % msg.nick))
|
||||
s = msg.nick + '!'
|
||||
irc.queueMsg(callbacks.reply(msg, s, prefixName=False))
|
||||
|
||||
def beGracious(self, irc, msg, match):
|
||||
r"\b(?:thank'?s?|thx|tnks?)\b"
|
||||
if irc.nick in msg.args[1]:
|
||||
s = 'you\'re welcome, %s' % msg.nick
|
||||
irc.queueMsg(reply(msg, s))
|
||||
irc.queueMsg(callbacks.reply(msg, s, prefixName=False))
|
||||
|
||||
|
||||
Class = Friendly
|
||||
|
@ -41,16 +41,22 @@ class FriendlyTestCase(PluginTestCase):
|
||||
self.assertNotError('heya, %s' % self.irc.nick)
|
||||
self.assertNotError('howdy %s' % self.irc.nick)
|
||||
self.assertNotError('hi, %s!' % self.irc.nick)
|
||||
self.assertNotRegexp('hi, %s' % self.irc.nick,
|
||||
'^%s: ' % self.irc.nick)
|
||||
|
||||
def testGoodbye(self):
|
||||
self.assertNotError('seeya %s!' % self.irc.nick)
|
||||
self.assertNotError('bye, %s.' % self.irc.nick)
|
||||
self.assertNotRegexp('bye, %s' % self.irc.nick,
|
||||
'^%s: ' % self.irc.nick)
|
||||
|
||||
def testBeGracious(self):
|
||||
self.assertNotError('thanks, %s' % self.irc.nick)
|
||||
self.assertNotError('thank you, %s' % self.irc.nick)
|
||||
self.assertNotError('thx %s' % self.irc.nick)
|
||||
self.assertNotError('%s: thx!' % self.irc.nick)
|
||||
self.assertNotRegexp('thanks, %s' % self.irc.nick,
|
||||
'^%s: ' % self.irc.nick)
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user