CLI Tool
create-discordjs-nextgen
Start an interactive wizard with one command and create Discord bot projects for JavaScript or TypeScript in seconds.
Quick Start
1npx create-discordjs-nextgen
1npx create-discordjs-nextgen my-awesome-bot2npx create-discordjs-nextgen my-awesome-bot --jsx
Wizard Flow
- Ask for the project name.
- Let you choose JavaScript or TypeScript.
- Offer Voice, JSX and Cache plugin options.
- Let you choose Starter, Basic or Advanced.
- Optionally run npm install automatically.
JSX Setup
If JSX is selected or --jsx is passed, the project is prepared automatically for JSX usage.
- discordjs-nextgen-jsx is added as a dependency.
- JSXPlugin is imported and app.use(new JSXPlugin()) is inserted into index.js or index.ts.
- jsconfig.json for JavaScript or tsconfig.json for TypeScript is created.
- A sample commands/prefix/hello.jsx or commands/prefix/hello.tsx command is generated.
1import { JSXPlugin } from 'discordjs-nextgen-jsx';23const app = new App({ intents: Intents.ALL });45app.use(new JSXPlugin());
1{2 "compilerOptions": {3 "jsx": "react-jsx",4 "jsxImportSource": "discordjs-nextgen-jsx"5 },6 "include": ["**/*"]7}
Cache Setup
The CLI offers two cache options: Cache (Sade) and Cache (with Redis).
- discordjs-nextgen-cache is added as a dependency.
- ioredis is added automatically if 'Cache (with Redis)' is selected.
- CachePlugin and the selected adapter (Memory or Redis) are injected into the entry file.
- A sample commands/prefix/money.js or commands/prefix/money.ts command is generated in the Advanced template.
1import { CachePlugin, MemoryAdapter } from 'discordjs-nextgen-cache';23const app = new App({ intents: Intents.ALL });45// Injected automatically by CLI6app.use(new CachePlugin({ adapter: new MemoryAdapter() }));
Voice Setup
If Voice is selected, the CLI adds the voice package, injects app.use(new VoicePlugin()) and writes a sample command in matching templates.
Templates
1Starter2- index.js / index.ts34Basic5- commands/prefix6- commands/slash7- commands/hybrid8- events910Advanced11- commands12- events13- buttons14- modals15- selects
JSX Example Command
1import { Container, TextDisplay } from 'discordjs-nextgen-jsx';23const hello = {4 name: 'hello',5 description: 'JSX example command',6 run: async (ctx) => {7 const card = (8 <Container accentColor={0x5865f2}>9 <TextDisplay content="Hello from JSX." />10 <TextDisplay content={`Author: ${ctx.user.username}`} />11 </Container>12 );1314 await ctx.reply({15 components: [card],16 });17 },18};1920export default hello;