Wolfram Alpha works again. Fixes #114.
This commit is contained in:
parent
9b6d8efaf7
commit
e55af556ae
|
@ -28,12 +28,15 @@ class MatrixModule(BotModule):
|
||||||
answer = query + ': '
|
answer = query + ': '
|
||||||
try:
|
try:
|
||||||
res = client.query(query)
|
res = client.query(query)
|
||||||
for pod in res.results:
|
result = "?SYNTAX ERROR"
|
||||||
for sub in pod.subpods:
|
if res['@success']=='true':
|
||||||
print(sub)
|
pod0=res['pod'][0]['subpod']['plaintext']
|
||||||
answer += str(sub.plaintext) + "\n"
|
pod1=res['pod'][1]
|
||||||
|
if (('definition' in pod1['@title'].lower()) or ('result' in pod1['@title'].lower()) or (pod1.get('@primary','false') == 'true')):
|
||||||
|
result = pod1['subpod']['plaintext']
|
||||||
|
answer += result + "\n"
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
answer = str(exc)
|
answer = "Wolfram Alpha has technical difficulty: " + str(exc)
|
||||||
|
|
||||||
await bot.send_text(room, answer)
|
await bot.send_text(room, answer)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue