mylife: add my life is twilight

master
mutantmonkey 2011-09-17 21:31:31 -04:00
parent c8512991ed
commit bd69dcfed4
1 changed files with 13 additions and 0 deletions

View File

@ -106,6 +106,19 @@ def mlih(phenny, input):
phenny.say(quote) phenny.say(quote)
mlih.commands = ['mlih'] 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__': if __name__ == '__main__':
print __doc__.strip() print __doc__.strip()