diff --git a/bot.py b/bot.py index 7cfc76c..191d7d2 100755 --- a/bot.py +++ b/bot.py @@ -159,6 +159,8 @@ class Phenny(irc.Bot): self.bot.msg(sender, origin.nick + ': ' + msg)) elif attr == 'say': return lambda msg: self.bot.msg(sender, msg) + elif attr == 'do': + return lambda msg: self.bot.action(sender, msg) return getattr(self.bot, attr) return PhennyWrapper(self) diff --git a/irc.py b/irc.py index a16c61b..f866e55 100755 --- a/irc.py +++ b/irc.py @@ -154,6 +154,10 @@ class Bot(asynchat.async_chat): self.sending.release() + def action(self, recipient, text): + textu = unicode(chr(1) + "ACTION %s" % text) + return self.msg(recipient, textu) + def notice(self, dest, text): self.write(('NOTICE', dest), text) diff --git a/modules/botfun.py b/modules/botfun.py new file mode 100755 index 0000000..9deea49 --- /dev/null +++ b/modules/botfun.py @@ -0,0 +1,26 @@ +#!/usr/bin/python2 +""" +botfight.py - .botfight module +author: mutantmonkey +""" + +import random + +otherbot = "truncatedcone" + +def botfight(phenny, input): + messages = ["hits %s", "punches %s", "kicks %s", "hits %s with a rubber hose", "stabs %s with a clean kitchen knife"] + response = random.choice(messages) + + phenny.do(response % otherbot) +botfight.commands = ['botfight'] +botfight.priority = 'low' + +def bothug(phenny, input): + phenny.do("hugs %s" % otherbot) +bothug.commands = ['bothug'] +bothug.priority = 'low' + +if __name__ == '__main__': + print __doc__.strip() +