bible plugin (for victor <3)

This commit is contained in:
Ryan Hitchman 2009-04-01 17:09:06 -06:00
parent 1a48955ee1
commit 87ed0e8e8f
2 changed files with 23 additions and 1 deletions

22
plugins/bible.py Normal file
View File

@ -0,0 +1,22 @@
import urllib
import hook
@hook.command('god')
@hook.command
def bible(inp):
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&passage='
text = urllib.urlopen(base_url + urllib.quote(inp)).read()
text = ' '.join(text.split())
if len(text) > 400:
text = text[:text.rfind(' ', 0, 400)] + '...'
return text

View File

@ -21,7 +21,7 @@ def sieve_suite(bot, input, func, args):
if input.command == 'INVITE':
print func, hook
input.re = re.match(hook, input.msg)
input.re = re.match(hook, input.msg, flags=re.I)
if input.re is None:
return None