diff --git a/config.sample.json b/config.sample.json index 66d68d51..46c97555 100644 --- a/config.sample.json +++ b/config.sample.json @@ -22,5 +22,11 @@ "owner": { "id": "123456789098765432" }, - "apiKeys": {} + "apiKeys": {}, + "paths": { + "commands": "./src/commands", + "events": "./src/events", + "locales": "./src/services/languages/locales" + }, + "defaultLang": "en-US" } \ No newline at end of file diff --git a/src/handlers/command-handler/index.js b/src/handlers/command-handler/index.js index a62b4bb4..6afbb311 100644 --- a/src/handlers/command-handler/index.js +++ b/src/handlers/command-handler/index.js @@ -1,3 +1,4 @@ +import { resolve } from "node:path"; import logger from "../../helpers/logger.js"; import { client } from "../../index.js"; import { getFilePaths } from "../../utils/index.js"; @@ -16,7 +17,8 @@ export const init = async () => { }; const buildCommands = async () => { - const commandFilePaths = (await getFilePaths("./newCommands", true)).filter(path => path.endsWith(".js")); + const cmdPath = resolve(client.configService.get("paths.commands")); + const commandFilePaths = (await getFilePaths(cmdPath, true)).filter(path => path.endsWith(".js")); for (const cmdFilePath of commandFilePaths) { const { data, run } = await import(toFileURL(cmdFilePath)); diff --git a/src/handlers/event-handler/index.js b/src/handlers/event-handler/index.js index bda401f0..a057b156 100644 --- a/src/handlers/event-handler/index.js +++ b/src/handlers/event-handler/index.js @@ -1,3 +1,4 @@ +import { resolve } from "node:path"; import logger from "../../helpers/logger.js"; import { client } from "../../index.js"; import { getFilePaths } from "../../utils/index.js"; @@ -12,7 +13,8 @@ export const init = async () => { const buildEvents = async () => { try { - const eventFilePaths = (await getFilePaths("./newEvents", true)).filter(path => path.endsWith(".js")); + const eventPath = resolve(client.configService.get("paths.events")); + const eventFilePaths = (await getFilePaths(eventPath, true)).filter(path => path.endsWith(".js")); for (const eventFilePath of eventFilePaths) { const { data, run } = await import(toFileURL(eventFilePath));