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