Repository navigation
Configuration
Everything is set in a file named .env, next to the program, plus a few files written by the bot itself.
- Open the Discord Developer Portal and click New Application.
- Under Bot, click Reset Token and copy the token. Keep it secret: anyone with it controls your bot.
- Under OAuth2 → URL Generator, select the scopes
botandapplications.commands, then open the generated link and add the bot to your server.
In Discord: User Settings → Advanced → Developer Mode on. Then right-click your server icon and choose Copy Server ID.
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_IDThose two lines are required. Everything else is optional.
| 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.
./nationdex-bot-linux-x64Watch the output for errors. A Discord bot token is missing error means .env was not found or TOKEN is empty.
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.
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.
| Path | What it is |
|---|---|
database/ |
All player, nation and settings data. Back this up |
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.