-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcmdcreate.js
More file actions
29 lines (27 loc) · 1.07 KB
/
cmdcreate.js
File metadata and controls
29 lines (27 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env node
const chalk = require('chalk');
console.clear()
const fs = require('fs');
const { exit } = require('process');
console.log(chalk.bold.cyan.bgRgb(20, 30, 45)('<--- Command Creator --->'));
const prompt = require("prompt-sync")({ sigint: true });
const https = require('https'); // or 'https' for https:// URLs
function sleep(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}
let commandname = prompt("> Command name: ");
let commandescription = prompt("> Description: ");
let commandcategory = prompt("> Category (ex. moderation): ");
if (!commandname) {
console.log(chalk.red.bold("Command name can't be empty. Creation aborted."))
exit()
}
//fs.createWriteStream(`src/cmds/${commandname}.cmd.js`);
console.log(chalk.bold.cyan("Command created!"));
async function writecmd() {
await sleep(200)
fs.writeFileSync(`src/cmds/${commandname}.cmd.js`, `module.exports = {\nname:"${commandname}",\ndescription:"${commandescription}",\ncategory:"${commandcategory}",\nrun(msg) {}}`);
}
writecmd()