UNPKG

discord-bot-cli

Version:

An easy way to build a command-based discord bot with discord.js.

30 lines (29 loc) 1.13 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const path_1 = __importDefault(require("path")); const fs_1 = __importDefault(require("fs")); const meow_1 = __importDefault(require("meow")); const helpString = ` Create a new localization file. Usage dbc loc path/to/file_without_extension `; function default_1() { const cli = meow_1.default(helpString); if (cli.input.length < 2) cli.showHelp(); const parsedPath = path_1.default.parse(cli.input[1]); fs_1.default.mkdirSync(parsedPath.dir, { recursive: true }); const filePath = path_1.default.resolve(path_1.default.format({ dir: parsedPath.dir, name: parsedPath.name, ext: ".json", })); const templatePath = path_1.default.resolve(__dirname, "../data/localization.json"); const template = fs_1.default.readFileSync(templatePath).toString(); fs_1.default.writeFileSync(filePath, template, { flag: "wx" }); } exports.default = default_1;