Skip to content

Instantly share code, notes, and snippets.

@totem3
Created August 10, 2014 01:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save totem3/eb01b2135d2b481abd5a to your computer and use it in GitHub Desktop.
Save totem3/eb01b2135d2b481abd5a to your computer and use it in GitHub Desktop.
# Description:
# clojure bot
https = require 'https'
module.exports = (robot) ->
bot_url = process.env.HUBOT_CLOJUREBOT_URL
bot_port = process.env.HUBOT_CLOJUREBOT_PORT
robot.hear /^(\(.*\))$/ig, (msg) ->
httprequest = msg.http("http://" + bot_url + ":" + bot_port)
data = JSON.stringify({"events":[ {"message": {"text": msg.match[0]}} ]})
try
httprequest.post(data) (err, res, body) ->
try
msg.send body
catch e
console.log(err, body)
catch e
console.log e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment