Added .botfight and .bothug

master
mutantmonkey 2010-12-11 15:47:24 -05:00
parent f3c80c2ba7
commit fe4721bb99
3 changed files with 32 additions and 0 deletions

2
bot.py
View File

@ -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)

4
irc.py
View File

@ -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)

26
modules/botfun.py Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/python2
"""
botfight.py - .botfight module
author: mutantmonkey <mutantmonkey@gmail.com>
"""
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()