From 6fd34567b6f90503959e8cc5003873b9afb3d0de Mon Sep 17 00:00:00 2001 From: mutantmonkey Date: Thu, 1 Sep 2011 09:40:25 -0400 Subject: [PATCH] add mlia and mlih, merge fml and mlib into mylife.py --- modules/fml.py | 30 --------------------- modules/mlib.py | 31 --------------------- modules/mylife.py | 68 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 61 deletions(-) delete mode 100755 modules/fml.py delete mode 100755 modules/mlib.py create mode 100644 modules/mylife.py diff --git a/modules/fml.py b/modules/fml.py deleted file mode 100755 index c0d1c92..0000000 --- a/modules/fml.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/python2 -""" -fml.py - fuck my life retrieval -author: Ramblurr -""" - -import random - -from urllib import quote as urlquote -from urllib2 import urlopen, HTTPError -import lxml.html - -def fml(phenny, input): - """.fml""" - try: - req = urlopen("http://www.fmylife.com/random") - except HTTPError: - phenny.say("THE INTERNET IS FUCKING BROKEN. Please try again later.") - return - - doc = lxml.html.parse(req) - - quote = doc.getroot().find_class('article')[0][0].text_content() - - phenny.say(quote) -fml.commands = ['fml'] - -if __name__ == '__main__': - print __doc__.strip() - diff --git a/modules/mlib.py b/modules/mlib.py deleted file mode 100755 index a74f854..0000000 --- a/modules/mlib.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/python2 -""" -mlib.py - my life is bro retrieval -author: Ramblurr -author: mutantmonkey -""" - -import random - -from urllib import quote as urlquote -from urllib2 import urlopen, HTTPError -import lxml.html - -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() - diff --git a/modules/mylife.py b/modules/mylife.py new file mode 100644 index 0000000..cf484fd --- /dev/null +++ b/modules/mylife.py @@ -0,0 +1,68 @@ +#!/usr/bin/python2 +""" +mylife.py - various commentary on life +author: Ramblurr +""" + +import random + +from urllib import quote as urlquote +from urllib2 import urlopen, HTTPError +import lxml.html + +def fml(phenny, input): + """.fml""" + try: + req = urlopen("http://www.fmylife.com/random") + except HTTPError: + phenny.say("THE INTERNET IS FUCKING BROKEN. Please try again later.") + return + + doc = lxml.html.parse(req) + quote = doc.getroot().find_class('article')[0][0].text_content() + phenny.say(quote) +fml.commands = ['fml'] + +def mlia(phenny, input): + """.mlia""" + try: + req = urlopen("http://mylifeisaverage.com/") + except HTTPError: + phenny.say("THE INTERNET IS FUCKING BROKEN. Please try again later.") + return + + doc = lxml.html.parse(req) + quote = doc.getroot().find_class('story')[0][0].text_content() + quote = quote.strip() + phenny.say(quote) +mlia.commands = ['mlia'] + +def mlih(phenny, input): + """.mlih""" + try: + req = urlopen("http://mylifeisho.com/random") + except HTTPError: + phenny.say("THE INTERNET IS FUCKING BROKEN. Please try again later.") + return + + doc = lxml.html.parse(req) + quote = doc.getroot().find_class('storycontent')[0][0].text_content() + 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) +mlih.commands = ['mlih'] + +if __name__ == '__main__': + print __doc__.strip() +