Skip to content

Instantly share code, notes, and snippets.

@markomanninen
Created November 3, 2011 21:39
Show Gist options
  • Save markomanninen/1337862 to your computer and use it in GitHub Desktop.
Save markomanninen/1337862 to your computer and use it in GitHub Desktop.
post request returns object
spun = (msg) ->
msg.http("http://api.spinnerchief.com:9001/")
.query
wordquality: 9
wordscount: 3
api_key: env.HUBOT_SPINNERCHIEF_API_KEY
username: env.HUBOT_SPINNERCHIEF_USERNAME
password: env.HUBOT_SPINNERCHIEF_PASSWORD
.post(msg.match[1]) (err, res, body) ->
if err
err
else if res.statusCode is 201
"Service not available!"
else
body.message
module.exports = (robot) ->
robot.hear /^spun me ([\s\S]*)/i, (msg) ->
msg.send "processing..."
msg.send spun(msg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment