commandkit 0.1.11-dev.20250330063035 → 0.1.11-dev.20250330073734
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/dist/index.d.ts +6 -0
- package/dist/index.js +52 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1164,6 +1164,7 @@ declare class AppCommandHandler {
|
|
|
1164
1164
|
private onMessageUpdate;
|
|
1165
1165
|
readonly commandRunner: AppCommandRunner;
|
|
1166
1166
|
constructor(commandkit: CommandKit);
|
|
1167
|
+
printBanner(): void;
|
|
1167
1168
|
getCommandsArray(): LoadedCommand[];
|
|
1168
1169
|
registerCommandHandler(): void;
|
|
1169
1170
|
prepareCommandRun(source: Interaction | Message$1, cmdName?: string): Promise<PreparedAppCommandExecution | null>;
|
|
@@ -1500,6 +1501,11 @@ declare class CommandKit extends EventEmitter {
|
|
|
1500
1501
|
* @param locale The default locale.
|
|
1501
1502
|
*/
|
|
1502
1503
|
setDefaultLocale(locale: Locale): this;
|
|
1504
|
+
/**
|
|
1505
|
+
* Sets the cache provider.
|
|
1506
|
+
* @param provider The cache provider.
|
|
1507
|
+
*/
|
|
1508
|
+
setCacheProvider(provider: CacheProvider): this;
|
|
1503
1509
|
/**
|
|
1504
1510
|
* Sets the localization strategy for the command handler.
|
|
1505
1511
|
* @param strategy The localization strategy.
|
package/dist/index.js
CHANGED
|
@@ -3437,6 +3437,7 @@ var init_AppCommandHandler = __esm({
|
|
|
3437
3437
|
init_AppCommandRunner();
|
|
3438
3438
|
init_constants();
|
|
3439
3439
|
init_types_package();
|
|
3440
|
+
init_colors();
|
|
3440
3441
|
commandDataSchema = {
|
|
3441
3442
|
command: /* @__PURE__ */ __name((c) => c instanceof import_discord10.SlashCommandBuilder || c instanceof import_discord10.ContextMenuCommandBuilder || c && typeof c === "object", "command"),
|
|
3442
3443
|
chatInput: /* @__PURE__ */ __name((c) => typeof c === "function", "chatInput"),
|
|
@@ -3464,6 +3465,41 @@ var init_AppCommandHandler = __esm({
|
|
|
3464
3465
|
onMessageCreate = null;
|
|
3465
3466
|
onMessageUpdate = null;
|
|
3466
3467
|
commandRunner = new AppCommandRunner(this);
|
|
3468
|
+
printBanner() {
|
|
3469
|
+
const categorizedCommands = this.getCommandsArray().reduce(
|
|
3470
|
+
(acc, cmd) => {
|
|
3471
|
+
const category = cmd.command.category || "uncategorized";
|
|
3472
|
+
acc[category] = acc[category] || [];
|
|
3473
|
+
acc[category].push(cmd);
|
|
3474
|
+
return acc;
|
|
3475
|
+
},
|
|
3476
|
+
{}
|
|
3477
|
+
);
|
|
3478
|
+
const categories = Object.keys(categorizedCommands).sort();
|
|
3479
|
+
console.log(
|
|
3480
|
+
colors_default.green(
|
|
3481
|
+
`Loaded ${colors_default.magenta(this.loadedCommands.size.toString())} commands:`
|
|
3482
|
+
)
|
|
3483
|
+
);
|
|
3484
|
+
categories.forEach((category, index) => {
|
|
3485
|
+
const commands = categorizedCommands[category];
|
|
3486
|
+
const isLastCategory = index === categories.length - 1;
|
|
3487
|
+
const categoryPrefix = isLastCategory ? "\u2514\u2500" : "\u251C\u2500";
|
|
3488
|
+
if (category !== "uncategorized") {
|
|
3489
|
+
console.log(colors_default.cyan(`${categoryPrefix} ${colors_default.bold(category)}`));
|
|
3490
|
+
}
|
|
3491
|
+
commands.forEach((cmd, cmdIndex) => {
|
|
3492
|
+
const isLastCommand = cmdIndex === commands.length - 1;
|
|
3493
|
+
const commandPrefix = category !== "uncategorized" ? (isLastCategory ? " " : "\u2502 ") + (isLastCommand ? "\u2514\u2500" : "\u251C\u2500") : isLastCommand ? "\u2514\u2500" : "\u251C\u2500";
|
|
3494
|
+
const name = cmd.data.command.name;
|
|
3495
|
+
const hasMw = cmd.command.middlewares.length > 0;
|
|
3496
|
+
const middlewareIcon = hasMw ? colors_default.magenta(" (\u03BB)") : "";
|
|
3497
|
+
console.log(
|
|
3498
|
+
`${colors_default.green(commandPrefix)} ${colors_default.yellow(name)}${middlewareIcon}`
|
|
3499
|
+
);
|
|
3500
|
+
});
|
|
3501
|
+
});
|
|
3502
|
+
}
|
|
3467
3503
|
getCommandsArray() {
|
|
3468
3504
|
return Array.from(this.loadedCommands.values());
|
|
3469
3505
|
}
|
|
@@ -3803,7 +3839,7 @@ var init_CommandsRouter = __esm({
|
|
|
3803
3839
|
import_promises4 = require("fs/promises");
|
|
3804
3840
|
import_node_path4 = require("path");
|
|
3805
3841
|
MIDDLEWARE_PATTERN = /^\+middleware\.(m|c)?(j|t)sx?$/;
|
|
3806
|
-
COMMAND_PATTERN = /^(
|
|
3842
|
+
COMMAND_PATTERN = /^([^+().][^().]*)\.(m|c)?(j|t)sx?$/;
|
|
3807
3843
|
CATEGORY_PATTERN = /^\(\w+\)$/;
|
|
3808
3844
|
_CommandsRouter = class _CommandsRouter {
|
|
3809
3845
|
constructor(options) {
|
|
@@ -4536,6 +4572,19 @@ var init_CommandKit = __esm({
|
|
|
4536
4572
|
this.config.defaultLocale = locale;
|
|
4537
4573
|
return this;
|
|
4538
4574
|
}
|
|
4575
|
+
/**
|
|
4576
|
+
* Sets the cache provider.
|
|
4577
|
+
* @param provider The cache provider.
|
|
4578
|
+
*/
|
|
4579
|
+
setCacheProvider(provider) {
|
|
4580
|
+
if (!(provider instanceof CacheProvider)) {
|
|
4581
|
+
throw new Error(
|
|
4582
|
+
colors_default.red("Cache provider must be an instance of CacheProvider.")
|
|
4583
|
+
);
|
|
4584
|
+
}
|
|
4585
|
+
this.options.cacheProvider = provider;
|
|
4586
|
+
return this;
|
|
4587
|
+
}
|
|
4539
4588
|
/**
|
|
4540
4589
|
* Sets the localization strategy for the command handler.
|
|
4541
4590
|
* @param strategy The localization strategy.
|
|
@@ -4642,6 +4691,7 @@ var init_CommandKit = __esm({
|
|
|
4642
4691
|
await this.plugins.execute((ctx, plugin) => {
|
|
4643
4692
|
return plugin.onAfterCommandsLoad(ctx);
|
|
4644
4693
|
});
|
|
4694
|
+
this.commandHandler.printBanner();
|
|
4645
4695
|
}, "#initCommands");
|
|
4646
4696
|
initEvents_fn = /* @__PURE__ */ __name(async function() {
|
|
4647
4697
|
await this.plugins.execute((ctx, plugin) => {
|
|
@@ -4674,7 +4724,7 @@ var init_version = __esm({
|
|
|
4674
4724
|
"use strict";
|
|
4675
4725
|
init_cjs_shims();
|
|
4676
4726
|
version = /* @__MACRO__ $version */
|
|
4677
|
-
"0.1.11-dev.
|
|
4727
|
+
"0.1.11-dev.20250330073734";
|
|
4678
4728
|
}
|
|
4679
4729
|
});
|
|
4680
4730
|
|