You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
434 B

# -*- coding: utf-8 -*-
from __future__ import absolute_import
import pmxbot
from pmxbot.core import command
import wolframalpha
@command(aliases='wolframalpha')
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'])
res = client.query(rest)
return next(res.results).text