A Discord bot that shows the current season state and player count on a Don't Starve Together dedicated server.
- The bot is
🟢Online
when there are players on the server and🌙Idle
when there are none. - Bot activity status message displays the current season, current day in season, day phase, and total days in the season.
- When there are players online, the status message also includes the number of players.
Example status messages:
🍂Autumn ☀️Day 7/20
❄️Winter ☀️Day 8/12 🧍2
🌸Spring 🌙Night 5/20 🧍3
☀️Summer 🌄Dusk 1/12
- 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
andMESSAGE CONTENT INTENT
options. - In Settings > OAuth2 > Url Generator enable the scope
bot
and bot permissionsManage Webhooks
,Read Messages/View Channels
,Send Messages
, andUse Embedded Activities
. - Visit the generated URL to invite the bot into your Discord channel.
- Copy the ID of a Discord text channel you want the bot to participate
- enable Developer Mode (under User Settings > Advanced)
- right-click on the channel to see get the ID.
This bot has been designed and tested only against the https://github.com/Jamesits/docker-dst-server/ dedicated server Docker image, and as such, is expected to run in a Docker container on the same server.
An example compose file is included with the project (just fill in the DISCORD_TOKEN environment variable).
Please note that the container leverages direct access to the DST server container via Docker exec API and thus is
expecting to run with priviliged=true
and have access to the host /var/run/docker.sock
file.
The script that is being executed inside the DST server container connects to the running game server
process and sends the server console commands c_dumpseasons(); print("Current phase: " .. TheWorld.components.worldstate.data.phase); c_listallplayers()
which dumps the current season, day phase, and player info into the game logs.
- DISCORD_TOKEN - Discord access token generated during bot setup.
- DISCORD_LOGIN_TIMEOUT - Number of milliseconds the bot waits to establish the initial Discord session. Defaults to
60000
. - LOG_FILE - Path to DST cluster master node server logs file. Defaults to
/data/DoNotStarveTogether/Cluster_1/Master/server_log.txt
- TIMESTAMP_PATTERN - Timestamp format used in DST server logs file. Defaults to
\[\d{2}:\d{2}:\d{2}\]
- DST_CLUSTER_DIR - Path to the DST server cluster directory. Defaults to
/data/DoNotStarveTogether/Cluster_1/
. - DST_CONTAINER_NAME - Docker container name of the DST server. Defaults to
dst
. - UPDATE_FREQUENCY - Frequency in milliseconds how often the bot updates status info. Defaults to
30000
.
- Jaak Kütt jaakkytt
- Start by creating an issue https://github.com/jaakkytt/dst-server-status-bot/issue.
- Fork and modify.
- Add/update tests (sufficiently, a subjective measure).
- Make sure tests pass (
npm run test
). - Make sure ESLint passes (
npm run lint
). - Update the version nr in
package.json
following Semantic Versioning 2.0.0. - Reference the issue nr in the branch (e.g.
feature/nr-few-words
) and commit messages. - Create a pull request.