A Discord bot that reports the daytime and the current player count of a 7 Days to Die game server as the bot activity state. The bot switches its afk status to Idle when there are no players on the server, and Online when there are players.
Example statuses:
๐๏ธDay 118/119, 12:00 ๐ง1
๐Day 119, 12:00 ๐ง2
๐Day 120, 03:00 ๐ง4
๐๏ธDay 120/126, 04:01 ๐ง1
๐๏ธPaused at Day 122/126, 04:11
Currently, there are some assumptions on the game server configurations:
TelnetEnabled
is set totrue
TelnetPort
andTelnetPassword
values have been specifiedBloodMoonFrequency
has a default value of7
- Create a new bot application in the Discord Developer Portal
- In Settings > Bot: use the Reset Token button to generate a new token, copy that for later
- In Settings > Bot > Privileged Gateway Intents: enable PRESENCE INTENT and MESSAGE CONTENT INTENT
- In Settings > OAuth2 > Url Generator: check the scope
bot
and bot permissionsRead Messages/View Channels
,Send Messages
, andUse Embedded Activities
- Use the generated URL to invite the bot in your Discord channel.
If your game server is running on the https://github.com/Didstopia/7dtd-server container image,
you can simply run the bot in a Docker container next to your game instance. Adjust the variables and volume mappings
accordingly. Or set up a container created from the jaakkytt/7days-to-die-time-bot:latest
image,
and additionally specify the TELNET_HOST
and TELNET_PORT
variables.
services:
game:
container_name: 7d2d
image: didstopia/7dtd-server:latest
restart: unless-stopped
ports:
- "26900:26900/tcp"
- "26900:26900/udp"
- "26901:26901/udp"
- "26902:26902/udp"
volumes:
- ./game:/steamcmd/7dtd
- ./data:/app/.local/share/7DaysToDie
environment:
- SEVEN_DAYS_TO_DIE_UPDATE_CHECKING=0
- SEVEN_DAYS_TO_DIE_BRANCH=public
- SEVEN_DAYS_TO_DIE_TELNET_PORT=8081
- SEVEN_DAYS_TO_DIE_TELNET_PASSWORD=
bot:
container_name: time-bot
image: jaakkytt/7days-to-die-time-bot:latest
restart: unless-stopped
depends_on:
- game
environment:
- DISCORD_TOKEN=
- DISCORD_LOGIN_TIMEOUT=60000
- DISCORD_UPDATE_INTERVAL=20000
- TELNET_HOST=game
- TELNET_PORT=8081
- TELNET_PASSWORD=
If you wish to run the Node.js application outside the container:
- clone this repo,
- run
npm install
, - run
npm run build
, - create an
.env
file from.env.example
and fill in the variables in that file, - and run
node dist/app.js