A Twitter bot for looking up Small Robots robots.
Running at @smolbotbot on Twitter! 🤖
You will need:
- Docker and Docker Compose
- Twitter API credentials
First, clone the repository:
git clone --recurse-submodules git@github.com:Pantonshire/SmolBotBot.git
cd SmolBotBot
Create a .env
file for Docker Compose to use, setting the following environment variables:
DATABASE_PASSWORD
: the password to use for the new PostgreSQL instanceTWITTER_CONSUMER_KEY
,TWITTER_CONSUMER_SECRET
,TWITTER_TOKEN
andTWITTER_TOKEN_SECRET
: the OAuth 1.0a credentials for the Twitter API
Build the images (this may take some time):
docker-compose build && docker-compose build sbb
Create and run the containers:
docker-compose up -d
The Small Robots Archive will now be running on port 8080. However, there will be nothing to show because we haven't fetched any of the Small Robots from Twitter yet!
There's a couple of different ways to get the Small Robots from Twitter. The first is to search the @smolrobots timeline:
docker-compose run --rm sbb timeline.sh
Unfortunately, this can only be used to get recently-tweeted robots due to limitations of the Twitter API. For this reason, I maintain a complete list of Tweet IDs of robots, available at https://smolbotbot.com/bootstrap/ids. You can use this to get all of the robots from Twitter:
docker-compose run --rm -e SBB_BOOTSTRAP_URL=https://smolbotbot.com/bootstrap/ids sbb bootstrap.sh
I recommend you run the bootstrap command once, then periodically run the timeline command using something like cron.
To post a "small robot of the day" to Twitter:
docker-compose run --rm sbb daily.sh