Super Earth Broadcast

Super Earth Broadcast is a Discord bot for Helldivers 2 players. It follows the game’s galactic war through a community API and posts what changes to a channel of the server. I wrote it in JavaScript with discord.js, and it is deployed with Docker on a self-hosted server.
What it posts
Every ten minutes the bot asks the API for four feeds and compares each one with what it has already seen.
| Feed | What reaches the channel |
|---|---|
| Dispatches | Messages from the game’s high command |
| News | Patch notes and announcements published on Steam |
| Planets | A planet liberated, lost or successfully defended |
| Campaigns | A new defence or invasion, with its level and the time left |
The last item seen in each feed is stored in PostgreSQL and cached in Redis, so a restart does not post old news again. Updates that share a title are merged into a single message.
Commands
/superstore shows the armour on sale in the game’s Superstore and when the rotation ends. The answer comes from a second community API and stays in Redis until that rotation expires.
The bot also plays along with the game’s humour. It keeps lists of words in the database, and when a message puts a protected subject within five words of an insult, or an enemy within five words of praise, the bot deletes the message and posts a mock infraction notice.
Deployment
The bot runs in a container built from a Node 20 Alpine image, started with Docker Compose and restarted automatically if it stops.
Two GitHub Actions workflows handle delivery. The first runs ESLint on every push and pull request. When it passes on the main branch, the second connects to the server over SSH and runs these commands.
cd ~/discord-bot
git fetch --all
git reset --hard origin/main
docker compose down
docker compose up --build -d
docker image prune -fExplore the code on GitHub