Skip to content

Instantly share code, notes, and snippets.

@audstanley
Created January 8, 2016 02:27
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 audstanley/cc4275ce7c517e7b08c7 to your computer and use it in GitHub Desktop.
Save audstanley/cc4275ce7c517e7b08c7 to your computer and use it in GitHub Desktop.
module.exports = function(robot) {
return robot.hear(/\{.?(movie):.?"(.*?)",?.?(year):.?"(.*?)",?.?(opt):.?"(.*?)".?}/, function(res) {
console.log("Got input, using " + res.match[2] + " for the title, and " + res.match[4] + " for the year.");
var movie = require('node-movie');
var title = res.match[2];
var year = res.match[4];
console.log(title + ' ' + year);
function getMovie(movieData) {
movie('Alien', '1979', function (err, data) {
console.log(data.Poster);
res.send(data.Poster);
return movieData = data;
});
}
process.nextTick(getMovie);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment