a twitter and mastodon bot for node. tweets and toots very good friends.
you can run it on your computer or remix it into something new! you'll need nodeand yarn (and git) installed. then run:
git clone https://github.com/lostfictions/catbot
cd catbot
yarn install
yarn dev
in a server environment, this bot can be run withdocker for an easier time. (i recommenddokku if you're looking for a nice way to develop and hostbots.)
the bot needs environment variables if you want it to do stuff:
MASTODON_TOKEN
: a Mastodon user API tokenTWITTER_API_KEY
, TWITTER_API_SECRET
, TWITTER_ACCESS_KEY
, andTWITTER_ACCESS_SECRET
: you need all of these to make a tweet.DATA_DIR
: the directory in which to search for cat parts and store data onwhich words have been used recently. (default: 'data', already providedlocally)CRON_RULE
: the interval between each post, in crontab format. (default:every four hours)additionally, MASTODON_SERVER
(hardcoded in src/env.ts) controlsthe mastodon instance to which API calls should be made (usually where the botuser lives.)
catbot uses the envalid package which in turnwraps dotenv, so you can alternately stickany of the above environment variables in a file named .env
in the projectroot. (it's gitignored, so there's no risk of accidentally committing privateAPI tokens you put in there.)