Skip to content

Instantly share code, notes, and snippets.

Last active April 30, 2020 07:04
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dimo414/62f88a1b0917bd5e3a6bfe51c58ccca2 to your computer and use it in GitHub Desktop.
Run Slack Dogebot on Raspberry Pi

Build the Luit/dogebot binary (I prefer to do so in a Docker container) for ARM:

$ docker run -v /tmp:/mnt/tmp -it debian:testing
docker$ apt-get update && apt-get install -y git golang
# Ensure build dependencies are available locally
docker$ go get
docker$ git clone
docker$ cd dogebot/src/dogebot
# Build a Raspberry Pi binary
docker$ env GOOS=linux GOARCH=arm GOARM=5 go build
docker$ cp dogebot /mnt/tmp/
docker$ exit
$ scp /tmp/dogebot pi@hostname:

Then copy to ~ (you'll need to tweak the script if you want it/the binary to live somewhere other than your home directory), and add the following to your crontab:

*/5      * * * * bash /home/pi/ [YOUR SLACK API KEY]
# Crontab wrapper for the dogebot binary, to safely restart it if it crashes
if pgrep dogebot >/dev/null; then
# already running
key=${1:?API key}
date >> "$logfile"
SLACK_TOKEN=$key exec ~/dogebot >> "$logfile" 2>&1
Copy link

dimo414 commented Apr 30, 2020 suggests some better alternatives to scheduled polling with cron. Even the while-loop approach would probably be sufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment