Skip to content

Discord Bot

Scaffolds a TypeScript Discord bot using discord.js v14 with GatewayIntentBits for guilds, messages, and message content. Includes slash command registration and handling, a messageCreate handler with AI-powered responses, a pluggable LLM provider registry (Anthropic and OpenAI), and embed-based rich formatting for structured AI output.

Namediscord-bot
Version0.1.0
Categoryapplications
LicenseApache-2.0
Personaengineering
Tagstypescript, discord, bot, ai, chatbot
Sourcetemplates/discord-bot

Render it

Three front doors, one catalog. Pick whichever suits the caller.

# CLI
npx @nanohype/sdk render discord-bot --out ./my-app

# SDK
import { LocalSource, renderTemplate } from "@nanohype/sdk";
const result = await renderTemplate(source, "discord-bot", variables);

# MCP — from an agent
get_template({ name: "discord-bot" })

Prerequisites

ToolVersionWhy
node>=22Node.js runtime for the Discord bot

Variables

Required

ProjectName string
Kebab-case project name, used as package name and directory Must be lowercase kebab-case starting with a letter.

Optional

Description string — defaults to A Discord bot with AI
Short project description for package.json and README
LlmProvider string — defaults to anthropic
LLM provider to use for AI responses
IncludeTests bool — defaults to true
Include test files with vitest

What it produces

24 files. Placeholder names such as __APP_NAME__ are what the renderer substitutes into.

.env.example
.gitignore
biome.json
package.json
README.md
src/__tests__/commands.test.ts
src/bootstrap.ts
src/commands/ask.ts
src/commands/deploy.ts
src/config.ts
src/events/interaction-create.ts
src/events/message-create.ts
src/index.ts
src/logger.ts
src/providers/anthropic.ts
src/providers/index.ts
src/providers/mock.ts
src/providers/openai.ts
src/providers/registry.ts
src/providers/types.ts
src/resilience/__tests__/circuit-breaker.test.ts
src/resilience/circuit-breaker.ts
tsconfig.json
vitest.config.ts

Composes with