From 77df66a31b1f2d74940f07813ead05edd470f3ad Mon Sep 17 00:00:00 2001 From: mutantmonkey Date: Fri, 2 Sep 2011 01:16:19 -0400 Subject: [PATCH] more my life methods --- modules/mylife.py | 51 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/modules/mylife.py b/modules/mylife.py index fd74948..944a88c 100644 --- a/modules/mylife.py +++ b/modules/mylife.py @@ -52,6 +52,44 @@ def mliarab(phenny, input): phenny.say(quote) mliarab.commands = ['mliarab'] +def mlib(phenny, input): + """.mlib - My life is bro.""" + try: + req = urlopen("http://mylifeisbro.com/random") + except HTTPError: + phenny.say("MLIB is out getting a case of Natty. It's chill.") + return + + doc = lxml.html.parse(req) + quote = doc.getroot().find_class('storycontent')[0][0].text_content() + phenny.say(quote) +mlib.commands = ['mlib'] + +def mlid(phenny, input): + """.mlib - My life is Desi.""" + try: + req = urlopen("http://www.mylifeisdesi.com/random") + except HTTPError: + phenny.say("MLID is busy at the hookah lounge, be back soon.") + return + + doc = lxml.html.parse(req) + quote = doc.getroot().find_class('oldlink')[0].text_content() + phenny.say(quote) +mlid.commands = ['mlid'] + +def mlig(phenny, input): + """.mlig - My life is ginger.""" + try: + req = urlopen("http://www.mylifeisginger.org/random") + except HTTPError: + phenny.say("Busy eating your soul. Be back soon.") + return + + doc = lxml.html.parse(req) + quote = doc.getroot().find_class('oldlink')[0].text_content() + phenny.say(quote) +mlig.commands = ['mlig'] def mlih(phenny, input): """.mlih - My life is ho.""" @@ -66,19 +104,6 @@ def mlih(phenny, input): phenny.say(quote) mlih.commands = ['mlih'] -def mlib(phenny, input): - """.mlib""" - try: - req = urlopen("http://mylifeisbro.com/random") - except HTTPError: - phenny.say("MLIB is out getting a case of Natty. It's chill.") - return - - doc = lxml.html.parse(req) - quote = doc.getroot().find_class('storycontent')[0][0].text_content() - phenny.say(quote) -mlib.commands = ['mlib'] - if __name__ == '__main__': print __doc__.strip()