WebSnap
# Description: # Renders a webpage (url) to a png file for the user # # Dependencies: # None # # Configuration # Requires CutyCapt and xvfb ... and a webserver to save/publish the png's on # # Commands: # hubot websnap <url> # # Author: # bnp@mos-eisley.dk - https://www.mos-eisley.dk # module.exports = (robot) -> robot.respond /websnap (.*)$/i, (msg) -> argument = msg.match[1] date = new Date() useridstring = msg.message.user.id.toString() timeStamp = [date.getFullYear(), (date.getMonth() + 1), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()].join("") console.log("websnap url: " + argument) @exec = require('child_process').exec command = "xvfb-run -a /opt/hal9000/bin/CutyCapt --insecure --url=" + argument + " --out=/opt/hal9000/tmp/" + useridstring + timeStamp + ".png " @exec command, (error, stdout, stderr) -> console.log(error) console.log(stdout) console.log(stderr) msg.send "http://hal9000.myserver.dk/" + useridstring + timeStamp + ".png"