add my life is bro module

master
mutantmonkey 2011-09-01 00:50:14 -04:00
parent 5e50eb00f2
commit bde1c43780
1 changed files with 31 additions and 0 deletions

31
modules/mlib.py Executable file
View File

@ -0,0 +1,31 @@
#!/usr/bin/python2
"""
mlib.py - my life is bro retrieval
author: Ramblurr <unnamedrambler@gmail.com>
author: mutantmonkey <mutantmonkey@mutantmonkey.in>
"""
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()