Beginner's Setup Guide - d-zone-org/d-zone GitHub Wiki (2024)

Privileged Intents and Permissions Required

D-Zone relies on using the full member list as well as presence updates and message content from the Discord API. These are privileged intents that must be enabled in your bot application page. These intents are unrestricted if your bot is in less than 100 servers.

When adding the D-Zone bot to a server, make sure it has at least the View Channels permission. It should also have Send Messages to be able to respond to commands. No other permissions are required.

Heroku

For a simple setup, try free deployment on Heroku

Beginner's Setup Guide - d-zone-org/d-zone GitHub Wiki (1)

Docker

For a docker container setup with SSL, you can use this one created by Griefed:

Otherwise, read on.

Requirements

If you want to run D-Zone for your Discord server, you will need the following:

  • A computer to run the node server
    • The computer you're on right now would be fine, or you can use a node.js hosting service.
  • A port available on the node server for the websocket
    • This usually means port forwarding on your router, like when you host a game server.
  • A web host or local host for the client files
    • If hosting on HTTPS, you will need to provide an SSL certificate (try Let's Encrypt)
    • People tend to get stuck on this one, please find a web host before proceeding.
    • If you're on Linux, you can use NGINX as described in this guide for Linux

This guide is written for Windows, but much of it should be the same on other systems. My friend Macley has written Linux-specific and Windows-specific guides which include self-hosting the web files.

First, you must install Node. I use the LTS release.

To check that you have installed Node properly, open a command prompt and type node -v. It should tell you what version you have just installed. Also run npm -v to ensure this too was installed. If you're getting errors, you may need to reboot. If that still doesn't work, google how to add node and npm to your PATH variable.

Installation

Click the big green download button on D-Zone's GitHub page to download the ZIP. Inside is a folder called d-zone-master, extract it where you want. Then open that folder, and in an empty space right click while holding Shift and choose "Open command window here". You could also browse to the folder manually in CMD if you know how. Then run this:

npm install

This will take a few minutes. You may see some warnings, this is okay. If you get an error and the package did not install, you may need to download the Visual C++ runtimes from Microsoft. You also may need Python 2.7 installed. If all goes well, you should now have a node_modules folder.

Configuration

Create or set an environment variable called token to your bot's token. If you don't know how or don't want to use environment variables, create a file called .env in the project root with the text token=your_token_here. To get your bot's token, go here. If you aren't using a bot (you should use one), go google how to get your Discord token.

If you are hosting on HTTPS (recommended), you need to also set your cert and key variables to the full paths of your certificates (e.g. on Ubuntu /etc/letsencrypt/live/example.com/fullchain.pem and /etc/letsencrypt/live/example.com/privkey.pem). These can also be set in the .env file. Make sure node will have read permission for these files.

Rename discord-config-example.json to discord-config.json and insert the info for your Discord server(s). If you don't know your server ID, look in Server Settings > Widget in Discord. You must specify one default Discord server. You can include multiple servers here, and as long as your bot can connect to them, they will be available for clients to view.

If your server has thousands of members, you will probably want to hide offline users by adding hideOffline: true to your server options. You can password-protect a server from being viewed by a client by using the password property (see notes). Check the Configuration reference for more info.

Rename socket-config-example.json to socket-config.json and insert the address and port you want to run the websocket on. If you're going to run the server on your computer, this would be your IP. The port can be almost anything you want, but I recommend 3000. If you're behind a router, you may need to forward this port. If you are using HTTPS, set secure to true. Make sure the address matches your certificate name if using HTTPS. An IP address won't work with your certificate.

While in the same command prompt window (or in a new one, as long as it's pointed at your D-Zone folder) start the server with npm start or just node index.js

Uploading

The client files are all contained within the web folder, and need to be built with npm run-script build. After running that, you will have a file called bundle.js in /web/static. Upload everything in the web folder except the script folder to your web host. Do not remove the web folder from the package; the server component requires it.

Open a browser tab and visit the URL where you uploaded /web/index.html. If everything works, the client should connect to the default server, generate a world, and receive live updates via websocket from the server.

If you see "Upgrade required" then you are typing in the wrong URL. The websocket port is not to be visited in your browser! You simply need to visit the folder that you uploaded to your web host.

If it's stuck on "Connecting..." make sure that the port in your socket config is open.

You can tweak the message box parameters by editing misc-config.json. Check the Misc Config reference for details.

If you're having any other problems, you can catch me on Discord here: https://discord.gg/0MvHMfHcTKUvE2kC

Remember, this is still being developed! Check back for updates! :grinning: To get the latest version, you will have to download and install a new instance in a new folder, copy over your configuration files, and build again.

Notes

Respect the privacy of the users in your Discord server. By creating a D-Zone for your server without a password, you are allowing anyone with the URL to view any conversations your bot has permission to see.

The build script creates a minified bundle file with no source mapping, while watch is not minified but is quicker to run and has source mapping. So, watch is good for development and build is good for deployment. If you have no idea what this means, use build

Beginner's Setup Guide - d-zone-org/d-zone GitHub Wiki (2024)

References

Top Articles
Latest Posts
Article information

Author: Clemencia Bogisich Ret

Last Updated:

Views: 5792

Rating: 5 / 5 (60 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Clemencia Bogisich Ret

Birthday: 2001-07-17

Address: Suite 794 53887 Geri Spring, West Cristentown, KY 54855

Phone: +5934435460663

Job: Central Hospitality Director

Hobby: Yoga, Electronics, Rafting, Lockpicking, Inline skating, Puzzles, scrapbook

Introduction: My name is Clemencia Bogisich Ret, I am a super, outstanding, graceful, friendly, vast, comfortable, agreeable person who loves writing and wants to share my knowledge and understanding with you.