Skip to content

plummerfernandez/botcaves

Repository files navigation

botcaves

A collection of bot scripts to run from a Raspberry Pi.

Installation Notes

  1. For this workshop we are using rPis (B and B+) with WIFI dongles.
  2. The OS we've installed is Raspbian (on 8Gb SD’s for the Raspberry Pi B and 16Gb SDxC for the Raspberry Pi B+)
  3. The OS and WIFI setup is covered here: http://www.iiclouds.org/20141117/basic-instructions-to-set-up-a-raspberry-pi/
  4. Once you have the Pi connected to the WIFI and know its IP address you can connect to it from another computer with SSH
  5. In terminal on your main computer type ssh pi@xxx.xxx.x.xxx, you'll be asked to enter the Pi's password

you're in!

  1. Install some software on the pi. The following are terminal commands for upgrading python, installing pip and then tywthon
  2. sudo apt-get install python dev
  3. sudo apt-get install python-pip
  4. sudo pip install twython

you have python and libraries!

  1. Set up a new profile on twitter. Open an account, go to dev.twitter.com to create an app and get API keys.
  2. Download the twitterbot-example.py script and change it to have your new API keys.
  3. Open a new terminal window. We will use this to copy/paste over the twitterbot-example.py file
  4. scp /Users/myname/Desktop/botexample.py pi@XX.XXX.XXX.XXX:~/

your bot script in on the Pi!

  1. The script will be in the Pis HOME directory. You may want to move it somewhere else such as /usr/local/bin/
  2. In your SSH terminal session go to HOME directory. Run the script with this line of code:
  3. python twitterbot-example.py

the bot is running!

  1. To keep the bot running when you close SSH you may want to start it differently. The options are:
  2. install 'screen' (sudo apt-get install screen) then in SSH start the screen mode (screen) then run the bot
  3. Run with an ampersand (&) to keep script running 'headless' (python twitterbot-example.py &) *method not tested
  4. Set up either a cron timer or init launch deamon *method not tested

stop the bot!

  1. An aggressive way is to SSH in and type killall python
  2. alternatively ps -A | grep python, and you get the process id of this process. Then sudo kill <processid>

About

A collection of bot scripts to run from a raspberry pi

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages