A bot written in NodeJS that powers @PossumEveryHour, supporting various social media platforms and cryptographic functionality for quality randomness.
Supported Platforms
More platforms planned!
With v2.0.0 of the bot, the whole codebase was heavily refactored, and the Twitter part has been replaced to utilise V2 API that is compatible with the Twitter Developer Free Tier. You will now need an Access Token that has Read and Write permissions.
You NEED to generate and set up OAuth 2.0 Client ID and Client Secret to grand Read and Write permission to your Access Token. If you don't set this up, you will either receive 403 or 401 HTTP error codes.
Code for the V1 API Twitter bot can be located under the v1.1.0-legacytwitter tag.
NodeJS 18 and up For Twitter: Twitter Developer Account with V2 API access & Access Token with Read and Write permissions
For the MASTODON_SERVER
variable for Mastodon and BLUESKY_SERVER
variable for BlueSky/AT Protocol, you need to pass a full URL including https://
for the server.
MASTODON_SERVER="https://fqdn.local"
There are two ways of running the bot. Running it via a daemon process like PM2 (or running the main file manually) or using Docker.
docker-compose.yaml
file to adjust environment variable values. Use .env-example
as an example file. media
directory in the same path as docker-compose.yaml
and index.js
. docker compose up
These instructions are for running the bot on a Linux/Windows server system. Code not designed to run on serverless infrastructure like AWS Lambda, Azure Functions or running on Heroku.
index.js
is located and run npm install
to install the required dependenciesmedia
folder with pictures of your choosing. BlueSky has a limitation of formats and only supports JPEG and PNG..env
..env
file and add the required API keys. Use .env-example
as an example file. pm2 start -f index.js --name "PossumEveryHour"
If you are confused on where to start or you have no experience with Linux or servers in general, I'd suggest using something like a Raspberry Pi, or using an old computer to install Ubuntu Linux onto and run your own bot from that.
Rocky/RHEL8 ships with NodeJS 10 by default. Execute these commands to disable the NodeJS 10 DNF module, enable NodeJS 18 module and install NodeJS 18:
sudo dnf module disable nodejs:10 -y
sudo dnf module enable nodejs:18 -y
sudo dnf install @nodejs:18
Then verify:
$ node -v
v18.14.2
index.js
acts as the main/parent process that regulates the time and spawns child processes from the ehb_modules
generate_file.js
in a new child process. Its always ran first. This module processes the randomisation and returns a file path back to the parentindex.js
receives the file path back from the child and then spawns other modules for each social media platform with the file pathindex.js
waits for next runTested with Rocky Linux 8.5, npm 8.1.2 and nodejs v18.14.2