Skip to main content

Setup

Rendered from docs/common/setup.md

Generated on every docs build. Edit the source in docs/, not here.

Install and typecheck. Discord-specific setup — token wiring, registering slash commands, required intents — is in ../discord/setup.md.

Requirements​

  • Node ≥ 22.12 (engines in the root package.json).
  • npm (the repo uses npm workspaces: shared, bots/discord, docs-site).

Install​

npm install

One install at the repo root covers all three workspaces, including the Docusaurus toolchain the documentation site builds with. The bot has no build step: tsx runs the TypeScript directly. Only the docs site builds:

npm run docs -w @bots/docs-site # → docs-site/dist, served at /just-a-bot/docs

Verify​

npm run typecheck # tsc --noEmit across the workspaces
npm test # node:test suites for the pure game logic (*.test.ts)
npm run corpus:lint # corpus/ health check (frontmatter, links, page size)

The tests cover pure modules only: blackjack, Wordle, Connect Four, reminder parsing and delivery, RPG trades, the hangman word list. Anything that talks to Discord is still verified by running the bot.

Layout​

PathWhat
bots/discord/the bot (@bots/discord) — one directory per feature
shared/src/@bots/shared — logger, loadEnv, reminder parse/store
bots/data/persisted JSON state, gitignored
corpus/project knowledge: decisions, status, work lifecycle
docs/these docs — per-feature operating manuals
docs-site/the Docusaurus site that renders docs/ and corpus/

Environment​

Env is validated with Zod at startup via @bots/shared's loadEnv. Required config fails fast at boot; optional integrations report "not configured" instead of crashing the bot. Put values in bots/discord/.env — see ../discord/setup.md for the variable list.

One running instance per bot token. Discord delivers every interaction to every live gateway session, so running discord:dev locally while the VPS is up makes both instances answer and the loser throws DiscordAPIError 40060. Use a separate Discord application + token for local development.