Created
October 30, 2016 03:37
-
-
Save butackle/4df0232450c2f06c55e6e811e62014b0 to your computer and use it in GitHub Desktop.
paiza_run_bot script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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