Skip to content

Instantly share code, notes, and snippets.

@asenchi
Created December 16, 2011 05:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asenchi/1484579 to your computer and use it in GitHub Desktop.
Save asenchi/1484579 to your computer and use it in GitHub Desktop.
# Receive a fortune
#
# fortune me - Returns a random fortune
HTTP = require "http"
module.exports = (robot) ->
robot.hear /fortune( me)?/i, (response) ->
opt = { method: "GET", host: "fortunes.herokuapp.com", path: "/random" }
req = HTTP.request opt, (res) ->
response.send res.body["fortune"]
req.end()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment