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.
| Name | discord-bot |
| Version | 0.1.0 |
| Category | applications |
| License | Apache-2.0 |
| Persona | engineering |
| Tags | typescript, discord, bot, ai, chatbot |
| Source | templates/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
| Tool | Version | Why |
|---|---|---|
node | >=22 | Node.js runtime for the Discord bot |
Variables
Required
ProjectNamestring- Kebab-case project name, used as package name and directory Must be lowercase kebab-case starting with a letter.
Optional
Descriptionstring — defaults toA Discord bot with AI- Short project description for package.json and README
LlmProviderstring — defaults toanthropic- LLM provider to use for AI responses
IncludeTestsbool — defaults totrue- 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.tsComposes with
- Pairs with
module-queue-ts - Pairs with
module-database-ts - Pairs with
agentic-loop - Nests inside
monorepo