update wolfram alpha module
This commit is contained in:
parent
a9ee8ac6ad
commit
7e6c60dd61
@ -4,6 +4,12 @@
|
|||||||
# Dependencies:
|
# Dependencies:
|
||||||
# "wolfram":"0.3.1"
|
# "wolfram":"0.3.1"
|
||||||
#
|
#
|
||||||
|
# Configuration:
|
||||||
|
# WOLFRAM_API_KEY - self explanatory
|
||||||
|
#
|
||||||
|
# Commands
|
||||||
|
# hubot wolfram/wfa/quanto fa/compute ... - pone la domanda a Wolfram Alpha
|
||||||
|
#
|
||||||
# Author:
|
# Author:
|
||||||
# Enrico Fasoli (fazo96)
|
# Enrico Fasoli (fazo96)
|
||||||
#
|
#
|
||||||
@ -18,10 +24,7 @@ module.exports = (robot) ->
|
|||||||
res.send 'contattando Wolfram Alpha...'
|
res.send 'contattando Wolfram Alpha...'
|
||||||
wolfram.query res.match[1], (err, result) ->
|
wolfram.query res.match[1], (err, result) ->
|
||||||
if err then return res.send err
|
if err then return res.send err
|
||||||
#res.send JSON.stringify result
|
parseSubPod = (subpod) -> subpod.value or subpod.image
|
||||||
parseSubPod = (subpod) -> subpod.value
|
|
||||||
parsePod = (pod) ->
|
parsePod = (pod) ->
|
||||||
'\n=== ' + pod.title + '\n' + pod.subpods.map(parseSubPod).join('\n')
|
'\n=== ' + pod.title + '\n' + pod.subpods.map(parseSubPod).join('\n')
|
||||||
res.send (parsePod(pod) for pod in result).join('')
|
res.send (parsePod(pod) for pod in result).join('')
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user