Skip to content

Instantly share code, notes, and snippets.

@takakabe
Last active September 28, 2017 09:20
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 takakabe/5e18cc5734422f69b5be3bb0e45766a4 to your computer and use it in GitHub Desktop.
Save takakabe/5e18cc5734422f69b5be3bb0e45766a4 to your computer and use it in GitHub Desktop.
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