catbotmake cats

联合创作 · 2023-09-30 01:57

catbot

a twitter and mastodon bot for node. tweets and toots very good friends.

some cats

more cats

you can run it on your computer or remix it into something new! you'll need node and 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 with docker for an easier time. (i recommend dokku if you're looking for a nice way to develop and host bots.)

the bot needs environment variables if you want it to do stuff:

  • MASTODON_TOKEN: a Mastodon user API token
  • TWITTER_API_KEY, TWITTER_API_SECRET, TWITTER_ACCESS_KEY, and TWITTER_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 on which words have been used recently. (default: 'data', already provided locally)
  • CRON_RULE: the interval between each post, in crontab format. (default: every four hours)

additionally, MASTODON_SERVER (hardcoded in src/env.ts) controls the mastodon instance to which API calls should be made (usually where the bot user lives.)

catbot uses the envalid package which in turn wraps dotenv, so you can alternately stick any of the above environment variables in a file named .env in the project root. (it's gitignored, so there's no risk of accidentally committing private API tokens you put in there.)

more bots?
浏览 5
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报