Add magic 8-ball, tweak mylife

master
mutantmonkey 2011-09-02 17:11:12 -04:00
parent 77df66a31b
commit 4b6ebf0f21
2 changed files with 56 additions and 2 deletions

52
modules/8ball.py Normal file
View File

@ -0,0 +1,52 @@
#!/usr/bin/python2
"""
8ball.py - magic 8-ball
author: mutantmonkey <mutantmonkey@mutantmonkey.in>
"""
import random
def eightball(phenny, input):
""".8ball - Magic 8-ball."""
strong_yes = [
'45 seconds full throttle',
'It is certain',
'It is decidedly so',
'Without a doubt',
'Yes--definitely',
'You may rely on it',
]
tentative_yes = [
'As I see it, yes',
'Most likely',
'Outlook good',
'Signs point to yes',
'Yes',
]
negative = [
'Your request is not bro enough',
'Reply hazy, try again',
'Ask again later',
'Better not tell you now',
'Cannot predict now',
'Concentrate and ask again',
]
noncommital = [
'I am sorry, too high to respond',
"Don't count on it",
'My reply is no',
'My sources say no',
'Outlook not so good',
'Very doubtful'
]
# black magic
quotes = strong_yes + tentative_yes + negative + noncommital
quote = random.choice(quotes)
phenny.reply(quote)
eightball.commands = ['8ball']
if __name__ == '__main__':
print __doc__.strip()

View File

@ -2,6 +2,7 @@
""" """
mylife.py - various commentary on life mylife.py - various commentary on life
author: Ramblurr <unnamedrambler@gmail.com> author: Ramblurr <unnamedrambler@gmail.com>
author: mutantmonkey <mutantmonkey@mutantmonkey.in>
""" """
import random import random
@ -47,10 +48,11 @@ def mliarab(phenny, input):
return return
doc = lxml.html.parse(req) doc = lxml.html.parse(req)
quote = doc.getroot().find_class('entry')[0][0].text_content() quotes = doc.getroot().find_class('entry')
quote = random.choice(quotes)[0].text_content()
quote = quote.strip() quote = quote.strip()
phenny.say(quote) phenny.say(quote)
mliarab.commands = ['mliarab'] mliarab.commands = ['mliar', 'mliarab']
def mlib(phenny, input): def mlib(phenny, input):
""".mlib - My life is bro.""" """.mlib - My life is bro."""