From 2c6e01a41d410eed1b7bfcf1973b2db53f68c292 Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Fri, 14 Feb 2014 19:56:11 +1300 Subject: [PATCH] Fixed up old religion.py plugin, added to disabled_stuff --- disabled_stuff/religion.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 disabled_stuff/religion.py diff --git a/disabled_stuff/religion.py b/disabled_stuff/religion.py new file mode 100644 index 0000000..552b23f --- /dev/null +++ b/disabled_stuff/religion.py @@ -0,0 +1,38 @@ +from util import hook, http + + +@hook.command('god') +@hook.command +def bible(inp): + """.bible -- gets from the Bible (ESV)""" + + base_url = ('http://www.esvapi.org/v2/rest/passageQuery?key=IP&' + 'output-format=plain-text&include-heading-horizontal-lines&' + 'include-headings=false&include-passage-horizontal-lines=false&' + 'include-passage-references=false&include-short-copyright=false&' + 'include-footnotes=false&line-length=0&' + 'include-heading-horizontal-lines=false') + + text = http.get(base_url, passage=inp) + + text = ' '.join(text.split()) + + if len(text) > 400: + text = text[:text.rfind(' ', 0, 400)] + '...' + + return text + + +@hook.command('allah') +@hook.command +def koran(inp): # Koran look-up plugin by Ghetto Wizard + """.koran -- gets from the Koran""" + + url = 'http://quod.lib.umich.edu/cgi/k/koran/koran-idx?type=simple' + + results = http.get_html(url, q1=inp).xpath('//li') + + if not results: + return 'No results for ' + inp + + return results[0].text_content()