Use simpler syntax now supported by pmxbot.

This commit is contained in:
Jason R. Coombs 2016-01-18 17:02:58 -05:00
parent 21f4044ef1
commit cff8e08013

View File

@ -6,8 +6,13 @@ from pmxbot.core import command
import wolframalpha import wolframalpha
@command("wolframalpha", aliases=('wa',), doc="Wolfram Alpha rules")
@command(aliases='wolframalpha')
def wa(client, event, channel, nick, rest): def wa(client, event, channel, nick, rest):
"""
A free-text query resolver by Wolfram|Alpha. Returns the first
result, if available.
"""
client = wolframalpha.Client(pmxbot.config['Wolfram|Alpha API key']) client = wolframalpha.Client(pmxbot.config['Wolfram|Alpha API key'])
res = client.query(rest) res = client.query(rest)
return next(res.results).text return next(res.results).text