Skip to content

Instantly share code, notes, and snippets.

@takakabe

takakabe/script.coffee

Last active Sep 28, 2017
Embed
What would you like to do?
RaspberryPi
module.exports = (robot) ->
robot.respond /写真/, (msg) ->
@exec = require('child_process').exec
command = "raspistill -vf -hf -o /home/pi/raspberry_bot/scripts/wawawa.jpg;
curl -F file=@/home/pi/raspberry_bot/scripts/wawawa.jpg -F channels=C99999999 -F token=xoxb-9999999999999999-XXXXXXXXXXXXXXXXXXXXXXXX https://slack.com/api/files.upload"
#msg.send "Command: #{command}"
msg.send "しゃしんとってるよ。ちょっとまってね。"
@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