Created
August 19, 2014 22:02
-
-
Save lucas-clemente/a7bf7804c39375b8d252 to your computer and use it in GitHub Desktop.
hubot YO
This file contains 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
# Description: | |
# YO | |
# | |
# Commands: | |
# hubot yo <name> - YO | |
module.exports = (robot) -> | |
robot.respond /YO (\w+)$/i, (msg) -> | |
token = process.env.HUBOT_YO_TOKEN | |
data = "api_token=#{token}&username=#{msg.match[1]}" | |
robot.http("http://api.justyo.co/yo/") | |
.header('Content-Type', 'application/x-www-form-urlencoded') | |
.post(data) (err, res, body) -> | |
if err || res.statusCode != 200 | |
msg.send "NO: #{body}" | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment