-
Notifications
You must be signed in to change notification settings - Fork 1
/
plopfile.mjs
49 lines (45 loc) · 1.27 KB
/
plopfile.mjs
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { relative } from "node:path";
import { Events } from "discord.js/src/util/Constants.js";
import AutocompletePrompt from "inquirer-autocomplete-prompt";
import fuzzy from "fuzzy";
export default function (
/** @type {import("plop").NodePlopAPI} */
plop
) {
plop.setPrompt("autocomplete", AutocompletePrompt);
plop.setHelper("relativePath", (from, to) => relative(from, to));
plop.setGenerator("command", {
description: "Discord.js [/] command",
prompts: [
{ type: "input", message: "Name", name: "name" },
{ type: "input", message: "Description", name: "description" },
],
actions: [
{
type: "add",
path: "src/commands/{{dashCase name}}.ts",
templateFile: "./templates/command.hbs",
},
],
});
plop.setGenerator("module", {
description: "Bot module",
prompts: [
{ type: "input", message: "Name", name: "name" },
{
type: "autocomplete",
message: "Event",
name: "event",
source: (_, input = "") =>
fuzzy.filter(input, Object.values(Events)).map((e) => e.original),
},
],
actions: [
{
type: "add",
path: "src/modules/{{dashCase name}}.ts",
templateFile: "./templates/module.hbs",
},
],
});
}