From bd69dcfed4a869b09ee16a3a8d6733d1b9021116 Mon Sep 17 00:00:00 2001 From: mutantmonkey Date: Sat, 17 Sep 2011 21:31:31 -0400 Subject: [PATCH] mylife: add my life is twilight --- modules/mylife.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/mylife.py b/modules/mylife.py index d4937cf..f2fb32d 100644 --- a/modules/mylife.py +++ b/modules/mylife.py @@ -106,6 +106,19 @@ def mlih(phenny, input): phenny.say(quote) mlih.commands = ['mlih'] +def mlit(phenny, input): + """.mlit - My life is Twilight.""" + try: + req = urlopen("http://mylifeistwilight.com/random") + except HTTPError: + phenny.say("Error: Your life is too Twilight. Go outside.") + return + + doc = lxml.html.parse(req) + quote = doc.getroot().find_class('fmllink')[0].text_content() + phenny.say(quote) +mlit.commands = ['mlit'] + if __name__ == '__main__': print __doc__.strip()