commandkit 0.1.11-dev.20250330115847 → 0.1.11-dev.20250330132632
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -48
- package/dist/index.js +10 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,55 +60,9 @@ npm install commandkit@dev
|
|
|
60
60
|
|
|
61
61
|
> ⚠️ The development version is likely to have bugs.
|
|
62
62
|
|
|
63
|
-
##
|
|
63
|
+
## Getting Started
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
```js
|
|
68
|
-
// index.js
|
|
69
|
-
const { Client, GatewayIntentBits } = require('discord.js');
|
|
70
|
-
const { CommandKit } = require('commandkit');
|
|
71
|
-
const path = require('path');
|
|
72
|
-
|
|
73
|
-
const client = new Client({
|
|
74
|
-
intents: [
|
|
75
|
-
GatewayIntentBits.Guilds,
|
|
76
|
-
GatewayIntentBits.GuildMessages,
|
|
77
|
-
GatewayIntentBits.MessageContent,
|
|
78
|
-
],
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
new CommandKit({
|
|
82
|
-
// Your discord.js client object
|
|
83
|
-
client,
|
|
84
|
-
|
|
85
|
-
// Path to the commands folder
|
|
86
|
-
commandsPath: path.join(__dirname, 'commands'),
|
|
87
|
-
|
|
88
|
-
// Path to the events folder
|
|
89
|
-
eventsPath: path.join(__dirname, 'events'),
|
|
90
|
-
|
|
91
|
-
// Path to the validations folder (only valid if "commandsPath" was provided)
|
|
92
|
-
validationsPath: path.join(__dirname, 'validations'),
|
|
93
|
-
|
|
94
|
-
// Array of development server IDs (used to register and run devOnly commands)
|
|
95
|
-
devGuildIds: ['1234567890', '0987654321'],
|
|
96
|
-
|
|
97
|
-
// Array of developer user IDs (used for devOnly commands)
|
|
98
|
-
devUserIds: ['1234567890', '0987654321'],
|
|
99
|
-
|
|
100
|
-
// Array of developer role IDs (used for devOnly commands)
|
|
101
|
-
devRoleIds: ['1234567890', '0987654321'],
|
|
102
|
-
|
|
103
|
-
// Disable CommandKit's built-in validations
|
|
104
|
-
skipBuiltInValidations: true,
|
|
105
|
-
|
|
106
|
-
// Update command registration/reload behaviour to register all commands at once
|
|
107
|
-
bulkRegister: true,
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
client.login('YOUR_TOKEN_HERE');
|
|
111
|
-
```
|
|
65
|
+
To get started with CommandKit, you can check out the [quick start guide](https://commandkit.dev/docs/next/guide/installation).
|
|
112
66
|
|
|
113
67
|
## Support and Suggestions
|
|
114
68
|
|
package/dist/index.js
CHANGED
|
@@ -5633,7 +5633,7 @@ var init_version = __esm({
|
|
|
5633
5633
|
"use strict";
|
|
5634
5634
|
init_cjs_shims();
|
|
5635
5635
|
version = /* @__MACRO__ $version */
|
|
5636
|
-
"0.1.11-dev.
|
|
5636
|
+
"0.1.11-dev.20250330132632";
|
|
5637
5637
|
}
|
|
5638
5638
|
});
|
|
5639
5639
|
|
|
@@ -6061,10 +6061,14 @@ __export(generators_exports, {
|
|
|
6061
6061
|
generateEvent: () => generateEvent,
|
|
6062
6062
|
generateLocale: () => generateLocale
|
|
6063
6063
|
});
|
|
6064
|
+
function determineExtension() {
|
|
6065
|
+
return (0, import_fs2.existsSync)((0, import_path4.join)(BASE_PATH, "tsconfig.json")) ? "ts" : "js";
|
|
6066
|
+
}
|
|
6064
6067
|
async function generateCommand(name, customPath) {
|
|
6065
|
-
const cmdPath = (0, import_path4.join)(customPath || COMMANDS_DIR
|
|
6068
|
+
const cmdPath = (0, import_path4.join)(customPath || COMMANDS_DIR);
|
|
6066
6069
|
if (!(0, import_fs2.existsSync)(cmdPath)) await (0, import_promises7.mkdir)(cmdPath, { recursive: true });
|
|
6067
|
-
|
|
6070
|
+
const fileName = `${name}.${determineExtension()}`;
|
|
6071
|
+
if ((0, import_fs2.existsSync)((0, import_path4.join)(cmdPath, fileName))) {
|
|
6068
6072
|
panic(`Command ${name} already exists.`);
|
|
6069
6073
|
}
|
|
6070
6074
|
const commandFile = `
|
|
@@ -6083,10 +6087,10 @@ export const message: MessageCommand = async (ctx) => {
|
|
|
6083
6087
|
await ctx.message.reply('Hello from ${name}!');
|
|
6084
6088
|
};
|
|
6085
6089
|
`.trim();
|
|
6086
|
-
await (0, import_promises7.writeFile)((0, import_path4.join)(cmdPath,
|
|
6090
|
+
await (0, import_promises7.writeFile)((0, import_path4.join)(cmdPath, fileName), commandFile);
|
|
6087
6091
|
console.log(
|
|
6088
6092
|
colors_default.green(
|
|
6089
|
-
`Command ${colors_default.magenta(name)} created at ${colors_default.blue(formatPath(cmdPath))}
|
|
6093
|
+
`Command ${colors_default.magenta(name)} created at ${colors_default.blue(formatPath(`${cmdPath}/${fileName}`))}`
|
|
6090
6094
|
)
|
|
6091
6095
|
);
|
|
6092
6096
|
}
|
|
@@ -6160,6 +6164,7 @@ var init_generators = __esm({
|
|
|
6160
6164
|
EVENTS_DIR = (0, import_path4.join)(BASE_PATH, "src/app/events");
|
|
6161
6165
|
LOCALES_DIR = (0, import_path4.join)(BASE_PATH, "src/app/locales");
|
|
6162
6166
|
formatPath = /* @__PURE__ */ __name((path2) => path2.replace(process.cwd(), ".").replace(/\\/g, "/"), "formatPath");
|
|
6167
|
+
__name(determineExtension, "determineExtension");
|
|
6163
6168
|
__name(generateCommand, "generateCommand");
|
|
6164
6169
|
__name(generateEvent, "generateEvent");
|
|
6165
6170
|
__name(generateLocale, "generateLocale");
|