Repository navigation
Bot Setup
-
Go to https://discord.com/developers/applications and click New Application.
-
On the Bot page, click Reset Token and copy it. This is
DISCORD_TOKEN; keep it secret. -
On General Information, copy the Application ID. This is
DISCORD_CLIENT_ID. -
Invite the bot to your server with this URL (put your application ID in):
https://discord.com/oauth2/authorize?client_id=YOUR_APP_ID&scope=bot+applications.commands&permissions=274877975552That grants View Channel, Send Messages, Send Messages in Threads and Read Message History. The bot needs all four in every channel and thread where people roll, because it posts damage requests, reveals and spell-save results there. For a private channel or thread, also add the bot to it.
-
In Discord, turn on User Settings → Advanced → Developer Mode, then:
- right-click your server → Copy Server ID: this is
DISCORD_GUILD_ID; - right-click your own name → Copy User ID: this goes in
GM_DISCORD_IDS.
- right-click your server → Copy Server ID: this is
In your copy of the bot folder (see Installation):
cp .env.example .env # Windows: Copy-Item .env.example .envFill in .env:
| Variable | What it is |
|---|---|
DISCORD_TOKEN |
The bot token from step 1. |
DISCORD_CLIENT_ID |
The application ID. |
DISCORD_GUILD_ID |
Your server ID. Commands are registered there. |
FOUNDRY_TOKEN |
Any long random string. Paste the same value into the module's Bot token in Foundry. |
FOUNDRY_ORIGIN |
The exact address you open Foundry at, e.g. https://my-foundry.example.com:30000 or http://localhost:30000. Separate several with commas. |
GM_DISCORD_IDS |
GM user IDs, comma-separated. They get the roll DMs and can use GM commands. |
ALLOWED_CHANNEL_IDS |
Optional. Only allow rolling in these channels; threads inside them count. |
PORT |
HTTP port for the module to reach, default 8787. |
DATA_DIR |
Where the bot keeps store.json, default ./data. |
npm install
npm run register # registers the slash commands in your server
npm startThe log should say HTTP API listening on :8787 and Logged in to Discord as ….
Run npm run register again whenever an update adds or changes commands.
For Docker, The Forge, Cloudflare Tunnel, VPS, Railway or Fly.io, see Hosting.
-
Linux / Raspberry Pi: a
systemdservice orpm2(pm2 start npm --name discord-roller -- start). -
Windows: a Task Scheduler task that runs at logon and starts
npm startin the bot folder, hidden. A small.vbslauncher keeps the window hidden. -
Fly.io / Railway / similar: mount a persistent volume at
DATA_DIR, or the bot forgets rolls and snapshots on each deploy.
The GM's browser talks to the bot directly, so the Bot URL you enter in Foundry must be reachable from that browser:
- If Foundry is served over https, the bot URL must be https too, because browsers block mixed content. The one exception is a bot on
http://localhost, which browsers allow. - If you open Foundry at a public address and the bot runs on
localhost, Chrome may ask once to allow local network access. Allow it, or syncing fails with "Can't reach the bot".
GET /api/health returns { ok, worlds: [{ worldId, worldTitle, system, snapshotAgeDays }] }. It's useful for uptime monitors and for checking that a world has synced.
Next: Foundry Setup.
Getting started
- Installation
- Bot Setup
- Hosting (Forge, cloud, VPS)
- Foundry Setup
Using it
- Player Guide
- GM Guide
- Commands
- Live Assistant (voice, GM-only)
Systems
Reference