Skip to content

Configuration

arielaram edited this page Nov 16, 2026 · 1 revision

Configuration

Everything is set in a file named .env, next to the program, plus a few files written by the bot itself.

1. Create a Discord application

  1. Open the Discord Developer Portal and click New Application.
  2. Under Bot, click Reset Token and copy the token. Keep it secret: anyone with it controls your bot.
  3. Under OAuth2 → URL Generator, select the scopes bot and applications.commands, then open the generated link and add the bot to your server.

2. Find your home server ID

In Discord: User Settings → Advanced → Developer Mode on. Then right-click your server icon and choose Copy Server ID.

3. Write .env

Create a file named exactly .env (no name before the dot) in the same folder as the program:

TOKEN=YOUR_DISCORD_BOT_TOKEN
HOME_GUILD_ID=YOUR_HOME_SERVER_ID

Those two lines are required. Everything else is optional.

Optional settings

Variable Default Purpose
API_PORT 2222 Port of the internal API
DATABASE_FOLDER ./database Where the embedded database lives
PANEL_PORT 3000 Port of the admin panel
PANEL_HOST 0.0.0.0 Address the panel listens on. Use 127.0.0.1 when Nginx or Ngrok is in front
PANEL_TLS_CERT and PANEL_TLS_KEY unset Paths to a certificate and key. Serves HTTPS directly
API_BASE_URL http://127.0.0.1:2222/v1 Only if the panel must call a different API
API_BEARER_TOKEN unset Only if you want the panel to use a token you made yourself

Never commit .env or share it. It is in .gitignore for that reason.

4. First start

./nationdex-bot-linux-x64

Watch the output for errors. A Discord bot token is missing error means .env was not found or TOKEN is empty.

5. Claim ownership

In your home server, run:

/access claim

This makes your Discord account the owner. Owners get every capability. Only the Discord application owner (the account that created the app) can claim. Other staff get roles afterwards through /access grant.

6. Set up the admin panel

Open http://localhost:3000 in a browser on the same machine. The first visit asks you to create the owner account of the panel: a username and a password of at least 4 characters. Use a strong password if the panel is reachable from the internet.

The panel gets its API token by itself, so you do not write a token anywhere.

Files the bot creates

Path What it is
database/ All player, nation and settings data. Back this up

Changing settings later

Most bot settings are changed from the admin panel or the /admin and /access commands, not by editing files. Changes made through the API or panel are written to the audit log (/access audit).

Changes to .env need a restart.

Clone this wiki locally