in-irc documentation for wikipedia

This commit is contained in:
Ryan Hitchman 2009-04-03 12:40:53 -06:00
parent ff37c5f7cb
commit c93d99147a
1 changed files with 7 additions and 4 deletions

View File

@ -13,12 +13,15 @@ search_url = api_prefix + "?action=opensearch&search=%s&format=xml"
paren_re = re.compile('\s*\(.*\)$') paren_re = re.compile('\s*\(.*\)$')
@hook.command(hook='w (.*)') @hook.command(hook='w(\s+.*|$)')
@hook.command @hook.command
def wiki(query): def wiki(query):
print query '''.w/.wiki <phrase> -- gets first sentence of wikipedia article on <phrase>'''
q = search_url % (urllib.quote(query, safe=''))
print q if not query.strip():
return wiki.__doc__
q = search_url % (urllib.quote(query.strip(), safe=''))
x = etree.parse(q) x = etree.parse(q)
ns = '{http://opensearch.org/searchsuggest2}' ns = '{http://opensearch.org/searchsuggest2}'