Skip to content

Commit 8d8ef70

Browse files
author
xyzjesper
committed
fixed module loading...
1 parent 966f4b5 commit 8d8ef70

6 files changed

Lines changed: 32 additions & 32 deletions

File tree

src/handler/files/buttons.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export async function loadButtons(client: ExtendedClient): Promise<void> {
1414
try {
1515
client.buttons?.clear();
1616

17-
const modulesFolder = path.join(process.cwd(), ".build", "src", "modules");
17+
const modulesFolder = path.join(process.cwd(), "src", "modules");
1818
if (!fs.existsSync(modulesFolder)) {
1919
console.warn("Modules folder does not exist.".red);
2020
return;
@@ -32,7 +32,7 @@ export async function loadButtons(client: ExtendedClient): Promise<void> {
3232
continue;
3333
}
3434

35-
const buttonFiles = getFilesRecursively(buttonFolder, [".js"]);
35+
const buttonFiles = getFilesRecursively(buttonFolder, [".ts"]);
3636

3737
for (const filePath of buttonFiles) {
3838
const fileName = path.basename(filePath, path.extname(filePath));

src/handler/files/commands.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export async function loadCommands(client: ExtendedClient) {
1616
client.subCommands?.clear?.();
1717
client.subCommandGroups?.clear?.();
1818

19-
const modulesFolder = path.join(process.cwd(), ".build", "src", "modules");
19+
const modulesFolder = path.join(process.cwd(), "src", "modules");
2020
if (!fs.existsSync(modulesFolder)) {
2121
console.warn("Modules folder does not exist.".red);
2222
return;
@@ -52,7 +52,7 @@ export async function loadCommands(client: ExtendedClient) {
5252

5353
// Commands
5454
if (fs.existsSync(commandDirs.commands)) {
55-
const allCommandFiles = getFilesRecursively(commandDirs.commands, [".js"]);
55+
const allCommandFiles = getFilesRecursively(commandDirs.commands, [".ts"]);
5656
for (const filePath of allCommandFiles) {
5757
const fileName = path.basename(filePath);
5858
try {
@@ -81,7 +81,7 @@ export async function loadCommands(client: ExtendedClient) {
8181

8282
// Context Menus
8383
if (fs.existsSync(commandDirs.contextMenus)) {
84-
const contextMenuFiles = getFilesRecursively(commandDirs.contextMenus, [".js"]);
84+
const contextMenuFiles = getFilesRecursively(commandDirs.contextMenus, [".ts"]);
8585
for (const filePath of contextMenuFiles) {
8686
const fileName = path.basename(filePath);
8787
try {
@@ -105,7 +105,7 @@ export async function loadCommands(client: ExtendedClient) {
105105

106106
// User Install Commands
107107
if (fs.existsSync(commandDirs.userInstall)) {
108-
const userInstallFiles = getFilesRecursively(commandDirs.userInstall, [".js"]);
108+
const userInstallFiles = getFilesRecursively(commandDirs.userInstall, [".ts"]);
109109
for (const filePath of userInstallFiles) {
110110
const fileName = path.basename(filePath);
111111
try {
@@ -134,7 +134,7 @@ export async function loadCommands(client: ExtendedClient) {
134134

135135
// User Install Subcommands
136136
if (fs.existsSync(commandDirs.userInstallSub)) {
137-
const userInstallSubCommandFiles = getFilesRecursively(commandDirs.userInstallSub, [".js"]);
137+
const userInstallSubCommandFiles = getFilesRecursively(commandDirs.userInstallSub, [".ts"]);
138138
for (const filePath of userInstallSubCommandFiles) {
139139
const fileName = path.basename(filePath);
140140
try {
@@ -158,7 +158,7 @@ export async function loadCommands(client: ExtendedClient) {
158158

159159
// Subcommands
160160
if (fs.existsSync(commandDirs.subCommands)) {
161-
const subCommandFiles = getFilesRecursively(commandDirs.subCommands, [".js"]);
161+
const subCommandFiles = getFilesRecursively(commandDirs.subCommands, [".ts"]);
162162
for (const filePath of subCommandFiles) {
163163
const fileName = path.basename(filePath);
164164
try {
@@ -182,7 +182,7 @@ export async function loadCommands(client: ExtendedClient) {
182182

183183
// Subcommand Groups
184184
if (fs.existsSync(commandDirs.subCommandGroups)) {
185-
const subCommandGroupFiles = getFilesRecursively(commandDirs.subCommandGroups, [".js"]);
185+
const subCommandGroupFiles = getFilesRecursively(commandDirs.subCommandGroups, [".ts"]);
186186
for (const filePath of subCommandGroupFiles) {
187187
const fileName = path.basename(filePath);
188188
try {

src/handler/files/events.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export async function loadEvents(client: ExtendedClient) {
1717
try {
1818
client.events?.clear();
1919

20-
const modulesFolder = path.join(process.cwd(), ".build", "src", "modules");
20+
const modulesFolder = path.join(process.cwd(), "src", "modules");
2121
if (!fs.existsSync(modulesFolder)) {
2222
console.warn("Modules folder does not exist.".red);
2323
return;
@@ -36,7 +36,7 @@ export async function loadEvents(client: ExtendedClient) {
3636
continue;
3737
}
3838

39-
const eventFiles = getFilesRecursively(eventFolder, [".js"]);
39+
const eventFiles = getFilesRecursively(eventFolder, [".ts"]);
4040

4141
for (const filePath of eventFiles) {
4242
const fileName = path.basename(filePath, path.extname(filePath));

src/handler/files/modals.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export async function loadModals(client: ExtendedClient): Promise<void> {
1717
try {
1818
client.modals?.clear();
1919

20-
const modulesFolder = path.join(process.cwd(), ".build", "src", "modules");
20+
const modulesFolder = path.join(process.cwd(), "src", "modules");
2121
if (!fs.existsSync(modulesFolder)) {
2222
console.warn("Modules folder does not exist.".red);
2323
return;
@@ -36,7 +36,7 @@ export async function loadModals(client: ExtendedClient): Promise<void> {
3636
continue;
3737
}
3838

39-
const modalFiles = getFilesRecursively(modalFolder, [".js"]);
39+
const modalFiles = getFilesRecursively(modalFolder, [".ts"]);
4040

4141
for (const filePath of modalFiles) {
4242
const fileName = path.basename(filePath, path.extname(filePath));

src/handler/files/selectmenus.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import colors from "colors";
22
import fs from "fs";
33
import path from "path";
44
import {pathToFileURL} from "url";
5-
import {getFilesRecursively} from "../../helper/fileHelper.js";
6-
import {ExtendedClient} from "../../types/ExtendedClient.js";
7-
import {LoggingAction} from "../../enums/loggingTypes.js";
8-
import {Logger} from "../../main/logger.js";
9-
import {Config} from "../../main/config.js";
5+
import {getFilesRecursively} from "../../helper/fileHelper";
6+
import {ExtendedClient} from "../../types/ExtendedClient";
7+
import {LoggingAction} from "../../enums/loggingTypes";
8+
import {Logger} from "../../main/logger";
9+
import {Config} from "../../main/config";
1010

1111
colors.enable();
1212

@@ -17,7 +17,7 @@ export async function loadSelectMenus(client: ExtendedClient): Promise<void> {
1717
try {
1818
client.selectmenus?.clear();
1919

20-
const modulesFolder = path.join(process.cwd(), ".build", "src", "modules");
20+
const modulesFolder = path.join(process.cwd(), "src", "modules");
2121
if (!fs.existsSync(modulesFolder)) {
2222
console.warn("Modules folder does not exist.".red);
2323
return;
@@ -36,10 +36,10 @@ export async function loadSelectMenus(client: ExtendedClient): Promise<void> {
3636
continue;
3737
}
3838

39-
const selectmenuFiles = getFilesRecursively(selectmenuFolder, [".js"]);
39+
const selectmenuFiles = getFilesRecursively(selectmenuFolder, [".ts"]);
4040

4141
for (const filePath of selectmenuFiles) {
42-
const fileName = path.basename(filePath, ".js");
42+
const fileName = path.basename(filePath, ".ts");
4343
try {
4444

4545
const moduleUrl = pathToFileURL(filePath).href;

src/helper/CommandHelper.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class CommandHelper {
3131
subCommandGroups: 0
3232
};
3333

34-
const modulesFolder = path.join(process.cwd(), ".build", "src", "modules");
34+
const modulesFolder = path.join(process.cwd(), "src", "modules");
3535
if (!fs.existsSync(modulesFolder)) {
3636
console.warn("Modules folder does not exist.".red);
3737
return;
@@ -57,7 +57,7 @@ export class CommandHelper {
5757

5858
// Load main commands
5959
if (fs.existsSync(commandDirs.commands)) {
60-
const commandFiles = getFilesRecursively(commandDirs.commands, [".js"]);
60+
const commandFiles = getFilesRecursively(commandDirs.commands, [".ts"]);
6161

6262
for (const filePath of commandFiles) {
6363
const relativePath = path.relative(commandDirs.commands, filePath);
@@ -79,7 +79,7 @@ export class CommandHelper {
7979

8080
// Load context menu commands
8181
if (fs.existsSync(commandDirs.contextMenus)) {
82-
const contextCommandFiles = getFilesRecursively(commandDirs.contextMenus, [".js"]);
82+
const contextCommandFiles = getFilesRecursively(commandDirs.contextMenus, [".ts"]);
8383
for (const filePath of contextCommandFiles) {
8484
try {
8585
const module = await import(pathToFileURL(filePath).href);
@@ -95,12 +95,12 @@ export class CommandHelper {
9595

9696
// Count subCommands and subCommandGroups (für Stats)
9797
if (fs.existsSync(commandDirs.subCommands)) {
98-
const subCommandFiles = getFilesRecursively(commandDirs.subCommands, [".js"]);
98+
const subCommandFiles = getFilesRecursively(commandDirs.subCommands, [".ts"]);
9999
stats.subCommands += subCommandFiles.length;
100100
}
101101

102102
if (fs.existsSync(commandDirs.subCommandGroups)) {
103-
const subCommandGroupFiles = getFilesRecursively(commandDirs.subCommandGroups, [".js"]);
103+
const subCommandGroupFiles = getFilesRecursively(commandDirs.subCommandGroups, [".ts"]);
104104
stats.subCommandGroups += subCommandGroupFiles.length;
105105
}
106106
}
@@ -276,7 +276,7 @@ export class CommandHelper {
276276
subCommandGroups: 0
277277
};
278278

279-
const modulesFolder = path.join(process.cwd(), ".build", "src", "modules");
279+
const modulesFolder = path.join(process.cwd(), "src", "modules");
280280
if (!fs.existsSync(modulesFolder)) {
281281
console.warn("Modules folder does not exist.".red);
282282
return;
@@ -303,7 +303,7 @@ export class CommandHelper {
303303

304304
// Load main commands
305305
if (fs.existsSync(commandDirs.commands)) {
306-
const commandFiles = getFilesRecursively(commandDirs.commands, [".js"]);
306+
const commandFiles = getFilesRecursively(commandDirs.commands, [".ts"]);
307307

308308
for (const filePath of commandFiles) {
309309
const relativePath = path.relative(commandDirs.commands, filePath);
@@ -325,7 +325,7 @@ export class CommandHelper {
325325

326326
// Load userInstall commands
327327
if (fs.existsSync(commandDirs.userInstall)) {
328-
const userCommandFiles = getFilesRecursively(commandDirs.userInstall, [".js"]);
328+
const userCommandFiles = getFilesRecursively(commandDirs.userInstall, [".ts"]);
329329
for (const filePath of userCommandFiles) {
330330
try {
331331
const module = await import(pathToFileURL(filePath).href);
@@ -341,7 +341,7 @@ export class CommandHelper {
341341

342342
// Load context menu commands
343343
if (fs.existsSync(commandDirs.contextMenus)) {
344-
const contextCommandFiles = getFilesRecursively(commandDirs.contextMenus, [".js"]);
344+
const contextCommandFiles = getFilesRecursively(commandDirs.contextMenus, [".ts"]);
345345
for (const filePath of contextCommandFiles) {
346346
try {
347347
const module = await import(pathToFileURL(filePath).href);
@@ -357,12 +357,12 @@ export class CommandHelper {
357357

358358
// Count subCommands and subCommandGroups (für Stats)
359359
if (fs.existsSync(commandDirs.subCommands)) {
360-
const subCommandFiles = getFilesRecursively(commandDirs.subCommands, [".js"]);
360+
const subCommandFiles = getFilesRecursively(commandDirs.subCommands, [".ts"]);
361361
stats.subCommands += subCommandFiles.length;
362362
}
363363

364364
if (fs.existsSync(commandDirs.subCommandGroups)) {
365-
const subCommandGroupFiles = getFilesRecursively(commandDirs.subCommandGroups, [".js"]);
365+
const subCommandGroupFiles = getFilesRecursively(commandDirs.subCommandGroups, [".ts"]);
366366
stats.subCommandGroups += subCommandGroupFiles.length;
367367
}
368368
}

0 commit comments

Comments
 (0)