2010-04-23 03:47:41 +00:00
|
|
|
from util import hook, http
|
2010-01-17 04:24:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
@hook.command('god')
|
|
|
|
@hook.command
|
|
|
|
def bible(inp):
|
|
|
|
".bible <passage> -- gets <passage> from the Bible (ESV)"
|
|
|
|
|
2010-04-23 03:47:41 +00:00
|
|
|
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')
|
2010-01-17 04:24:36 +00:00
|
|
|
|
2010-04-23 03:47:41 +00:00
|
|
|
text = http.get(base_url, passage=inp)
|
2010-01-17 04:24:36 +00:00
|
|
|
|
|
|
|
text = ' '.join(text.split())
|
|
|
|
|
|
|
|
if len(text) > 400:
|
|
|
|
text = text[:text.rfind(' ', 0, 400)] + '...'
|
|
|
|
|
|
|
|
return text
|
2010-04-10 22:05:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
@hook.command('allah')
|
|
|
|
@hook.command
|
2010-04-23 03:50:56 +00:00
|
|
|
def koran(inp): # Koran look-up plugin by Ghetto Wizard
|
2010-04-10 22:05:06 +00:00
|
|
|
".koran <chapter.verse> -- gets <chapter.verse> from the Koran"
|
|
|
|
|
2010-04-23 03:47:41 +00:00
|
|
|
url = 'http://quod.lib.umich.edu/cgi/k/koran/koran-idx?type=simple'
|
2010-04-10 22:05:06 +00:00
|
|
|
|
2010-04-23 03:47:41 +00:00
|
|
|
results = http.get_html(url, q1=inp).xpath('//li')
|
2010-04-23 03:50:56 +00:00
|
|
|
|
2010-04-10 22:05:06 +00:00
|
|
|
if not results:
|
|
|
|
return 'No results for ' + inp
|
|
|
|
|
|
|
|
return results[0].text_content()
|