Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

🐶🐱🐣 This is a twitter bot that posts a random adoptable pet from Chemnitz's shelter.

License

Notifications You must be signed in to change notification settings

CodeforChemnitz/CutePetsChemnitz

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CutePetsChemnitz

Post an random pet from shelter Chemnitz (OT Röhrsdorf) on Twitter @petschemnitz

About

Originated as a project of Team Denver during the 2014 fellowship at Code for America. Originally specific to Denver, it's been redeployed by a few cities. Check out this twitter list to see where.

Links to Bot

Setup & Deployment

nodejs

https://nodejs.org/

ruby

sudo apt-get install ruby ruby-dev rake
sudo gem install bundler

Redis

sudo apt-get install redis

Configure Redis in src/server.coffee

Repo

cd /opt/
git clone https://github.com/CodeforChemnitz/CutePetsChemnitz.git
cd CutePetsChemnitz

API

The API is available via http://127.0.0.1:3000/

Install

cd API
npm install
npm run-script build

Run

node lib/cron.js
node lib/server.js

Deploy

Install Service

sudo ln -s /opt/CutePetsChemnitz/API/forever_cutepets /etc/init.d
sudo update-rc.d forever_cutepets defaults
sudo service forever_cutepets start

Adding a Cronjob:

# Scrape shelters every 6 hours
50 */6 * * *   root node /opt/CutePetsChemnitz/API/lib/cron.js

Twitter

  1. Create a new twitter app.
  2. On the API key tab for the Twitter app, modify permissions so the app can Read and Write.
  3. Create an access token. On the API Key tab in Twitter for the app, click Create my access token
  4. Take note of the values for environment set up below. Note: It's important to change permissions to Read/Write before generating the access token. The access token is keyed for the specific access level and will not be updated when changing permissions.

Environmental variables

  1. Create a local .env file: cp template.env .env
  2. Fill in the twitter keys created above.

Install

bundler install

Run

rake

Deploy

Adding a Cronjob:

# Post a pet every hour
5 9-22/2 * * *  root cd /opt/CutePetsChemnitz && rake

Hat tips

About

🐶🐱🐣 This is a twitter bot that posts a random adoptable pet from Chemnitz's shelter.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CoffeeScript 43.6%
  • Shell 35.2%
  • Ruby 21.2%