rcnlx
Version:
A cli to generate discord.js projects
72 lines (70 loc) • 1.91 kB
JavaScript
#!/usr/bin/env node
const inquirer = require("inquirer");
const command = require("./templates/command");
const newProject = require("./templates/project");
const event = require("./templates/event");
const chalk = require('chalk')
inquirer
.prompt([
{
type: "list",
message: "Please choose an action",
name: "options",
choices: ["New Project", "Command", "Event"],
},
])
.then(({ options }) => {
if (options === "Command") {
inquirer
.prompt([
{
type: "input",
name: "commandName",
message: "What is the command's name?",
},
{
type: "input",
name: "category",
message: "Which category should this command be located?",
},
{
type: "input",
name: "cooldown",
message: "Command's cooldown? (miliseconds)",
}
])
.then(({ commandName, category, cooldown }) => {
command(commandName, category, commandName, cooldown);
});
} else if (options === "New Project") {
inquirer
.prompt([
{
type: "input",
name: "botToken",
message: "What is the bot's token?",
},
{
type: "input",
name: "botPrefix",
message: "What is the bot's prefix?",
},
])
.then(({ botToken, botPrefix }) => {
newProject(botToken, botPrefix);
});
} else {
inquirer
.prompt([
{
type: "list",
message: "Please choose a type of event",
name: "init",
choices: ["Client", "Guild"],
},
])
.then(({ init }) => {
event(init)
});
}
});