Hexaitos fec31cedcc | ||
---|---|---|
.env.example | ||
.gitignore | ||
COPYING | ||
Gemfile | ||
Gemfile.lock | ||
README.md | ||
local.rb | ||
main.rb |
README.md
Bot of Prey
Bot of Prey is a simple Mastodon / Fediverse bot that posts a random bird of prey taken from Wikimedia Commons. The bot makes an API call to my website, the source of which can also be found here.
Running the bot
You will need to have access to the bird API. You can either host it yourself or use the publically available one at birds.bateleur.org/api/random. You will also need an API token for a Fediverse instance. I have tried this with both Mastodon and GoToSocial, I do not know if any others work the same way.
You must then create a .env
file within this directory and put the following lines into it:
API_KEY = "API_KEY_FOR_FEDIVERSE_INSTANCE"
INSTANCE_URL = "URL_TO_FEDIVERSE_INSTANCE"
BIRD_API_URL = "URL_TO_BIRD_API"
You can also copy the included .env.example
to .env
and place the correct values into the variables.
If you would then like for the bot to run every x hours, I would recommend either a systemd
service or a simple cron job. You can also save Bot of Prey‘s output to a file for logging. An example cron job (posts every six hours) could be as follows:
0 */6 * * * /home/user/bot_of_prey/main.rb >> /home/user/bot_of_prey.log 2>&1
You will also need to install all the requires gems. Make sure you have Bundler installed or install it with gem install bundler
if needed. Afterwards, run the bundle install
command, this should install all the required gems.