Created
November 3, 2011 21:39
-
-
Save markomanninen/1337862 to your computer and use it in GitHub Desktop.
post request returns object
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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