phenny-1/modules/mylife.py

28 lines
643 B
Python
Raw Normal View History

#!/usr/bin/python3
"""
mylife.py - various commentary on life
author: Ramblurr <unnamedrambler@gmail.com>
2011-09-02 17:11:12 -04:00
author: mutantmonkey <mutantmonkey@mutantmonkey.in>
"""
from tools import GrumbleError
import web
import lxml.html
def fml(phenny, input):
2013-10-05 19:20:37 -04:00
""".fml - Grab something from fmylife.com."""
2011-09-02 00:56:55 -04:00
try:
req = web.get("http://www.fmylife.com/random")
2013-06-09 01:27:24 -04:00
except:
raise GrumbleError("I tried to use .fml, but it was broken. FML")
doc = lxml.html.fromstring(req)
2017-02-11 01:21:04 -05:00
quote = doc.find_class('block')[1][0].text_content()
2011-09-02 00:56:55 -04:00
phenny.say(quote)
fml.commands = ['fml']
if __name__ == '__main__':
2011-09-22 14:17:27 -04:00
print(__doc__.strip())