New permissions system :D
This commit is contained in:
parent
d5ddc72a53
commit
9becfa9897
5 changed files with 103 additions and 63 deletions
|
@ -3,7 +3,7 @@ from util import hook, web, text
|
|||
|
||||
@hook.command
|
||||
def answer(inp):
|
||||
".answer <query> -- find the answer to a question on Yahoo! Answers"
|
||||
"answer <query> -- find the answer to a question on Yahoo! Answers"
|
||||
|
||||
query = "SELECT Subject, ChosenAnswer, Link FROM answers.search WHERE query=@query LIMIT 1"
|
||||
result = web.query(query, {"query": inp.strip()}).one()
|
||||
|
@ -13,4 +13,4 @@ def answer(inp):
|
|||
# we split the answer and .join() it to remove newlines/extra spaces
|
||||
answer = text.truncate_str(' '.join(result["ChosenAnswer"].split()), 80)
|
||||
|
||||
return u'\x02{}\x02 "{}" - {}'.format(result["Subject"], answer, short_url)
|
||||
return u'\x02{}\x02 "{}" - {}'.format(result["Subject"], answer, short_url)
|
||||
|
|
Reference in a new issue