Skip to main content

Discord Bot

Scaffold a Discord bot with discord.js, TypeScript, and explicit development and production entry points.

Why Use This Command?

  1. Includes a minimal client and login flow so you can add commands and events without rebuilding the project foundation.
  2. Keeps the bot token in an untracked .env file while documenting the required key in the tracked .env.sample.
  3. Uses Nova's type-check and transpile utilities so checking and production output follow the same contract as other workspaces.
  4. Can compose the background-service Docker profile with --docker-image without adding an HTTP port or health check.

Requirements

  • Node.js runtime — Use any Node.js LTS release.
  • Discord application token — Create a bot in the Discord Developer Portal and provide its token as DISCORD_TOKEN.
  • Empty directory or monorepo root — Nova auto-detects whether to create a project or add a workspace.

Usage

Options

FlagDescription
-d, --dry-runRun without writing any files.
--docker-imageAdd a production Node image and background-service Compose file.
--name <name>Project slug when creating a new monorepo; omit at an existing root.
--non-interactiveRequire every answer as a flag and do not open prompts.
--workspace-name <name>Workspace directory name.
--output <dir>Output directory.

Output Files

FileDescription
.env.sampleRequired DISCORD_TOKEN environment variable.
src/index.tsTyped Discord client, ready event, and login flow.
tsconfig.*.jsonNova strict Node.js configs for source, tooling, and tests.
package.jsondiscord.js dependencies and Nova-managed workspace scripts.

Non-Interactive Mode

bash
nova scaffold app discord-bot --non-interactive --name my-bot --workspace-name bot --output ./my-bot
nova scaffold app discord-bot --non-interactive --workspace-name bot --output ./apps/bot
nova scaffold app discord-bot --docker-image --non-interactive --name my-bot --workspace-name bot --output ./my-bot

Registration

Nova registers the workspace with the app role and trackable policy. Its package name follows {projectSlug}-app-{workspaceName}.