@hyperneutrino/djs-lite 1.4.1 → 1.4.2
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/index.ts +3 -5
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -29,8 +29,6 @@ import type { Dirent } from "node:fs";
|
|
|
29
29
|
import fs from "node:fs/promises";
|
|
30
30
|
import path from "node:path";
|
|
31
31
|
|
|
32
|
-
// TODO: comments (requires some refactoring of types to do right)
|
|
33
|
-
|
|
34
32
|
process.on("uncaughtException", (err) => console.error(err));
|
|
35
33
|
|
|
36
34
|
type Handler<T extends CommandInteraction | AutocompleteInteraction | MessageComponentInteraction | ModalSubmitInteraction> = (
|
|
@@ -133,7 +131,7 @@ async function importAll(
|
|
|
133
131
|
);
|
|
134
132
|
}
|
|
135
133
|
|
|
136
|
-
|
|
134
|
+
async function loadSubcommands(directory: string): Promise<{
|
|
137
135
|
options: ApplicationCommandSubCommandData[];
|
|
138
136
|
handlers: Map<string, Handler<ChatInputCommandInteraction>>;
|
|
139
137
|
}> {
|
|
@@ -155,7 +153,7 @@ export async function loadSubcommands(directory: string): Promise<{
|
|
|
155
153
|
return { options, handlers };
|
|
156
154
|
}
|
|
157
155
|
|
|
158
|
-
|
|
156
|
+
async function loadSubcommandsAndGroups(directory: string): Promise<{
|
|
159
157
|
options: (ApplicationCommandSubGroupData | ApplicationCommandSubCommandData)[];
|
|
160
158
|
handler: Handler<ChatInputCommandInteraction>;
|
|
161
159
|
}> {
|
|
@@ -245,7 +243,7 @@ export async function loadInteractions(client: Client, directory: string, argume
|
|
|
245
243
|
const mentionHandlers = new Map<string, Handler<MentionableSelectMenuInteraction>>();
|
|
246
244
|
const channelHandlers = new Map<string, Handler<ChannelSelectMenuInteraction>>();
|
|
247
245
|
|
|
248
|
-
await importAll({ directory, recursive: true }, async ({
|
|
246
|
+
await importAll({ directory, recursive: true }, async ({ relativePath, item }) => {
|
|
249
247
|
const handlerKey = relativePath.replace(/\.[^/.]+$/, "").replace(/\\/g, "/");
|
|
250
248
|
|
|
251
249
|
if (item instanceof ModalHandler) modalHandlers.set(handlerKey, item.handler);
|