How to Install | Support it on Patreon | Join the Discord | Website |
---|
7DTD-Discord is a Discord bot for 7 Days to Die. It integrates a dedicated game server's chat with Discord, granting players access to the server's chat through Discord.
The bot runs as a completely separate application, so no mods are required to run it.
This has tested well with the experimental Alpha 19 builds so far, but if you encounter any problems, feel free to open an issue.
See below for download links instructions on how to install the bot. Dedicated servers on PC only.
This script works by connecting to your server's console and monitoring it for chat messages. Messages are relayed to and from the server using Discord, allowing for communication between in-game players and Discord users.
I will continue to keep this project up-to-date with new features and fixes whenever possible. If running v1.3.0 or higher, notifications for updates are displayed in the terminal.
For support, questions, and comments, you can join the Discord server or contact me directly at contact@LakeYS.net. You can also submit an issue for bugs and support.
For developers: If you are interested in helping out, GitHub pull requests are welcome and greatly appreciated.
Commands can be sent via DM or in the specified chat channel.
7d!info
7d!time
7d!version
7d!players
exit
The bot can be configured by editing config.json. Here's a list of the preferences:
-
allow-exec-command
- Enables a command called7d!exec
. This allows anybody with the 'manage server' permission to execute commands on the server. The command works in any channel. WARNING: Enabling this may pose a security risk for your server. -
disable-commands
- Disable Discord commands such as 7d!time. Does not disable 7d!info. -
disable-chatmsgs
- Disable chat messages to and from the server. Does not disable other in-game messages such as join/leave and deaths. -
disable-join-leave-gmsgs
- Disables player join/leave messages. -
disable-misc-gmsgs
- Disables all other global messages (player deaths, etc.) -
disable-status-updates
- Disable the bot's presence and online status display. -
hide-prefix
- Hides all chat messages that start with a forward slash. This may be useful if your server uses commands. -
log-messages
- Chat messages will show up in the terminal. -
log-telnet
- All output from the connection will show up in the terminal. -
prefix
- The prefix for bot commands. ('7d!' by default) -
skip-discord-auth
- The bot will not log in to Discord.
You may experience bugs if running older versions of the game with this bot. Here are the versions used to develop the bot:
Bot Version | Game Version |
---|---|
v1.7 | Alpha 17 |
v1.0 - v1.6 | Alpha 16.4 |
- Log in to the Discord Developer Portal in a browser and click "Create an application". Name the bot anything you'd like. Write down the client ID as you'll need it for later.
- On the left hand side, click "Bot". Now click the "Add Bot" button to create your bot. Now you can set an avatar for your bot if desired.
- Once your bot is created, find the switch that is labeled "Public bot". Make sure that this is OFF. Click "Save Changes" to confirm.
- Under "Token" click the link that says "Click to Reveal Token". This is the password for your bot's account. You'll need both this and the Client ID number later. Copy them both somewhere safe or keep the tab open.
- Paste the URL below into your browser and replace "CLIENT_ID" with your client ID number. Hit enter and select the desired Discord server. Once this is done, the bot will show up in your server!
https://discordapp.com/oauth2/authorize?client_id=CLIENT_ID&scope=bot
- Download this repository and extract it somewhere on your server's system.
- Install Node.js LTS from this website.
- Once Node.js is finished installing, run install.bat in the bot's folder. This will automatically install the required modules for the bot.
- Now you'll need to edit your server's config xml file. If you're using the Steam dedicated server, it should be located in
C:\Program Files (x86)\Steam\steamapps\common\7 Days to Die Dedicated Server
. - Open serverconfig.xml in a text editor (Right click and select 'Edit' to open it in Nodepad) and find "TelnetEnabled". Set it to true. Make sure TelnetPort is 8081 (or use the "port" argument in config.json). Set a telnet password.
- Right click the bot's config.json file and click "Edit".
- Find "changeme" and replace it with your server's Telnet password. Replace "your_token_here" with the Discord token from earlier. If running the bot on a different network from the server, add
--ip=[your server's external ip]
(May require port forwarding if using an external IP. Make sure your Telnet password is secure.)
Once you complete all of this, you will be able to run the bot by opening run.bat. If you've done all of this correctly, you will see the following in the terminal:
Connected to game. Connected to 1 Discord Servers.
To set the channel for your server's chat, open Discord and type 7d!setchannel #yourchannel
in your server. If the setchannel command doesn't work, try setting it manually. Once complete, the bot should be all set!
Note that if you close this terminal the bot will be disconnected. The bot can be run in the background with no terminal by opening run_silent.vbs.
You may want to create a shortcut to run.bat or run_silent.vbs in your Startup folder:
C:\Users\[YOURNAME]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
The bot can be installed on Android devices using the Termux app. Once installed, enter apt update
and apt install nodejs curl
. Then, proceed with the installation as a Linux system. You may need access to a desktop computer in order to create the bot account.
Warning: For security purposes, please avoid running this bot on an unsecured network (such as public wi-fi).
The bot can be run from a Raspberry Pi device by installing NodeJS. You may need access to a desktop computer in order to create the bot account.
First, follow the NodeJS install instructions found here under "Debian and Ubuntu based Linux distributions".
If running the bot on the same network as the Raspberry Pi, you will likely need to enter the computer's internal IP. Open a commant prompt on the system that the server is running on and type ipconfig
. Look for the field labeled 'IPv4 address' and copy the IP next to it (the IP should start with 196.168
). Then, copy this IP into the config.json under 'ip'. If this does not work, consider forwarding your telnet port (make sure the password is secure) and using the network's external IP.
- Open a terminal on your system.
- Install Node.js and NPM. Install build tools if instructed. [How to install via package manager]. Skip this step if installing to an Android or Raspberry Pi device.
- Type
curl -L https://github.com/LakeYS/7DTD-Discord/releases/download/v1.7.2/7DTD-Discord.tar.gz > 7dtdbot.tar.gz
to download the bot's files to an archive named7dtdbot.tar.gz
. - Type
tar -xzf 7dtdbot.tar.gz
to extract the archive. This will create a directory named "7DTD-Discord-master". Navigate to the directory withcd 7DTD-Discord-master
. - Type
sudo chmod +x run.sh
. This gives you permission to execute run.sh. (If this does not work, trychmod +x run.sh
) - Type
npm install
to install the required packages for the bot to run.
- Log in to the Discord Developer Portal in a browser and click "Create an application". Name the bot anything you'd like. Write down the client ID as you'll need it for later.
- On the left hand side, click "Bot". Now click the "Add Bot" button to create your bot. Now you can set an avatar for your bot if desired.
- Once your bot is created, find the switch that is labeled "Public bot". Make sure that this is OFF. Click "Save Changes" to confirm.
- Under "Token" click the link that says "Click to Reveal Token". This is the password for your bot's account. You'll need both this and the Client ID number later. Copy them both somewhere safe or keep the tab open.
- Paste the URL below into your browser and replace "CLIENT_ID" with your client ID number. Hit enter and select the desired Discord server. Once this is done, the bot will show up in your server!
https://discordapp.com/oauth2/authorize?client_id=CLIENT_ID&scope=bot
- On your server's system, navigate to the game's directory and edit your the config xml file.
- Find "TelnetEnabled" and make sure it is set to "true". Set a telnet password and save the file. Make sure your telnet password is secure , especially if the telnet port is open or the server is running on a VPS.
- Now navigate back to the bot's folder. Edit config.json.
- Find the line containing
"password": "changeme",
and replace "changeme" with your server's telnet password. - If running the bot on a different network from the server, change "localhost" to your server's external IP. (If using an external IP to connect the bot, forwarding the telnet port may be required)
- Replace "your_token_here" with the Discord bot token from earlier. Keep the file open for the next section.
Once you complete all of this, you will be able to run the bot by executing run.sh (Navigate to the bot's directory and enter ./run.sh
). If you've done all of this correctly, you will see the following:
Connected to game. Connected to 1 Discord Servers.
To set the channel for your server's chat, open Discord and type 7d!setchannel #yourchannel
in your server. If the setchannel command doesn't work, try setting it manually. Once complete, the bot should be all set!