feat(create-discord-bot): Add prompts, command handler and deployment script (#9570)

* 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
This commit is contained in:
Suneet Tipirneni
2023-07-16 13:13:18 -04:00
committed by GitHub
parent e5effb6f6a
commit 84f1b1890d
25 changed files with 518 additions and 79 deletions

View File

@@ -0,0 +1,39 @@
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 });