Skip to content

Instantly share code, notes, and snippets.

@lucas-clemente
Created August 19, 2014 22:02
Show Gist options
  • Save lucas-clemente/a7bf7804c39375b8d252 to your computer and use it in GitHub Desktop.
Save lucas-clemente/a7bf7804c39375b8d252 to your computer and use it in GitHub Desktop.
hubot YO
# 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