Skip to content

Instantly share code, notes, and snippets.

@larzconwell
Created May 4, 2012 02:31
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 larzconwell/2591486 to your computer and use it in GitHub Desktop.
Save larzconwell/2591486 to your computer and use it in GitHub Desktop.
// MemePoster is the fastest way to get Hungry Academy Memes out to the world!
//
// post <image url> - puts an image on hungryacademymemes.com
var http = require('http')
, response
, options
, request;
module.exports = function(robot) {
robot.respond(/post( (\S+))?/i, function(msg) {
response = msg.match[2];
options = {
host: 'memer.herokuapp.com'
, method: 'POST'
, path: '/'
, headers: {
'Content-Type': 'application/x-www-form-urlencoded'
, 'Content-Length': params.length
}
};
request = http.request(options, function(response) {
response.setEncoding('utf8');
response.on('data', function(chunk) {
console.log(chunk);
});
});
request.write(params);
request.end();
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment