Skip to content

Instantly share code, notes, and snippets.

@butackle
Created October 30, 2016 03:37
Show Gist options
  • Save butackle/4df0232450c2f06c55e6e811e62014b0 to your computer and use it in GitHub Desktop.
Save butackle/4df0232450c2f06c55e6e811e62014b0 to your computer and use it in GitHub Desktop.
paiza_run_bot script
module.exports = (robot) ->
robot.hear /.+/i, (msg) ->
@exec = require('child_process').exec
user_name= msg.match[0].split(" ")[0];
Command = msg.match[0].replace(user_name,"");
@exec "#{Command}", (error, stdout, stderr) ->
msg.send error if error?
msg.send stdout if stdout?
msg.send stderr if stderr?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment