trivious 1.6.2 → 1.6.3
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.
|
@@ -29,7 +29,7 @@ class CommandRegistry extends BaseRegistry {
|
|
|
29
29
|
else continue;
|
|
30
30
|
const command = await this.importFile(commandFile);
|
|
31
31
|
if (!command || !command.active || !("data" in command)) continue;
|
|
32
|
-
if ("
|
|
32
|
+
if (command.context === "SlashCommand") {
|
|
33
33
|
const subcommandFiles = (await promises.readdir(fullPath)).filter(
|
|
34
34
|
(file) => (file.endsWith(".ts") || file.endsWith(".js")) && !file.startsWith("index.") && !file.endsWith(".d.ts")
|
|
35
35
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/registry/command.registry.ts"],"names":["fs"],"mappings":";;;;;;AAoBA,MAAO,wBAAsC,YAAA,CAAsB;AAAA,EACxD,KAAA,GAAQ,IAAI,UAAA,EAA4B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASlD,MAAM,KAAK,SAAA,GAAoB,eAAA,CAAgB,KAAK,IAAA,CAAK,KAAA,EAAO,UAAU,CAAC,CAAA,EAAG;AAC7E,IAAA,IAAI,CAAE,MAAM,MAAA,CAAO,SAAS,CAAA,EAAI;AAC/B,MAAA,OAAO,IAAA;AAAA,IACR;AAEA,IAAA,MAAM,OAAA,GAAU,MAAMA,QAAA,CAAG,OAAA,CAAQ,WAAW,EAAE,aAAA,EAAe,MAAM,CAAA;AAEnE,IAAA,KAAA,MAAW,SAAS,OAAA,EAAS;AAC5B,MAAA,MAAM,QAAA,GAAW,IAAA,CAAK,SAAA,EAAW,KAAA,CAAM,IAAI,CAAA;AAC3C,MAAA,IAAI,CAAC,KAAA,CAAM,WAAA,EAAY,EAAG;AAE1B,MAAA,MAAM,SAAA,GAAY,IAAA,CAAK,QAAA,EAAU,UAAU,CAAA;AAC3C,MAAA,MAAM,OAAA,GAAU,IAAA,CAAK,Q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MAAA,IAAA,CAAK,KAAA,CAAM,GAAA,CAAI,OAAA,CAAQ,IAAA,CAAK,MAAM,OAAO,CAAA;AAAA,IAC1C;AAEA,IAAA,OAAO,IAAA;AAAA,EACR;AACD","file":"command.registry.js","sourcesContent":["import { Collection, SlashCommandSubcommandBuilder } from \"discord.js\";\nimport {\n\tBaseRegistry,\n\tCommand,\n\tContextMenuCommand,\n\tSlashCommand,\n\tSlashSubcommand,\n} from \"src/shared/typings/index.js\";\nimport { exists, resolveUserPath } from \"src/shared/utility/functions.js\";\nimport { promises as fs } from \"fs\";\nimport path, { join } from \"node:path\";\n\n/**\n * Registry to load and get all commands.\n *\n * @export\n * @class CommandRegistry\n * @typedef {CommandRegistry}\n * @extends {BaseRegistry<AnyCommand>}\n */\nexport default class CommandRegistry extends BaseRegistry<Command> {\n\tprotected items = new Collection<string, Command>();\n\n\t/**\n\t * Load all commands and their subcommands\n\t *\n\t * @async\n\t * @param {string} [directory=getCorePath({ coreDirectory: \"commands\" })]\n\t * @returns {unknown}\n\t */\n\tasync load(directory: string = resolveUserPath(path.join(\"src\", \"commands\"))) {\n\t\tif (!(await exists(directory))) {\n\t\t\treturn this;\n\t\t}\n\n\t\tconst entries = await fs.readdir(directory, { withFileTypes: true });\n\n\t\tfor (const entry of entries) {\n\t\t\tconst fullPath = join(directory, entry.name);\n\t\t\tif (!entry.isDirectory()) continue;\n\n\t\t\tconst indexFile = join(fullPath, \"index.ts\");\n\t\t\tconst indexJs = join(fullPath, \"index.js\");\n\n\t\t\tlet commandFile = \"\";\n\t\t\tif (await exists(indexFile)) commandFile = indexFile;\n\t\t\telse if (await exists(indexJs)) commandFile = indexJs;\n\t\t\telse continue;\n\n\t\t\tconst command = (await this.importFile<Command>(commandFile)) as\n\t\t\t\t| SlashCommand\n\t\t\t\t| ContextMenuCommand\n\t\t\t\t| null;\n\t\t\tif (!command || !command.active || !(\"data\" in command)) continue;\n\n\t\t\tif (command.context === \"SlashCommand\") {\n\t\t\t\tconst subcommandFiles = (await fs.readdir(fullPath)).filter(\n\t\t\t\t\tfile =>\n\t\t\t\t\t\t(file.endsWith(\".ts\") || file.endsWith(\".js\")) &&\n\t\t\t\t\t\t!file.startsWith(\"index.\") &&\n\t\t\t\t\t\t!file.endsWith(\".d.ts\")\n\t\t\t\t);\n\n\t\t\t\tfor (const file of subcommandFiles) {\n\t\t\t\t\tconst subcommand = await this.importFile<SlashSubcommand>(join(fullPath, file));\n\t\t\t\t\tif (!subcommand) continue;\n\t\t\t\t\tif (!subcommand.data.name || !(subcommand.data instanceof SlashCommandSubcommandBuilder))\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\tif (!command.subcommands) command.subcommands = new Collection<string, SlashSubcommand>();\n\t\t\t\t\tcommand.subcommands.set(subcommand.data.name, subcommand);\n\t\t\t\t\tcommand.data.addSubcommand(subcommand.data);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.items.set(command.data.name, command);\n\t\t}\n\n\t\treturn this;\n\t}\n}\n"]}
|