mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
* feat(create-discord-bot): Add prompts, command handler and deployment script * fix: revert package template name * chore: make requested changes * chore: make requested changes * fix: remove uneeded listeners * fix: use `0` for eslint * fix: remaining requested changes * chore: requested changes * fix: remove redundant call
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import { program } from 'commander';
|
|
import prompts from 'prompts';
|
|
import { createDiscordBot } from './create-discord-bot.js';
|
|
|
|
program
|
|
.description('Create a basic discord.js bot.')
|
|
.option('--directory', 'The directory where this will be created.')
|
|
.option('--typescript', 'Whether to use the TypeScript template.')
|
|
.option('--javascript', 'Whether to use the JavaScript template.')
|
|
.parse();
|
|
|
|
let { typescript, javascript, directory } = program.opts();
|
|
|
|
if (!directory) {
|
|
directory = (
|
|
await prompts({
|
|
type: 'text',
|
|
name: 'directory',
|
|
initial: 'my-bot',
|
|
message: 'What is the name of the directory you want to create this project in?',
|
|
})
|
|
).directory;
|
|
}
|
|
|
|
if (typescript === undefined && javascript === undefined) {
|
|
const { useTypescript } = await prompts({
|
|
type: 'toggle',
|
|
name: 'useTypescript',
|
|
message: 'Do you want to use TypeScript?',
|
|
initial: true,
|
|
active: 'Yes',
|
|
inactive: 'No',
|
|
});
|
|
|
|
typescript = useTypescript;
|
|
javascript = !useTypescript;
|
|
}
|
|
|
|
await createDiscordBot({ typescript, javascript, directory });
|