mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-12-28 14:23:02 +05:00
feat: added paths in config
This commit is contained in:
parent
7109a2a0ef
commit
bce6242e1e
3 changed files with 13 additions and 3 deletions
|
@ -22,5 +22,11 @@
|
|||
"owner": {
|
||||
"id": "123456789098765432"
|
||||
},
|
||||
"apiKeys": {}
|
||||
"apiKeys": {},
|
||||
"paths": {
|
||||
"commands": "./src/commands",
|
||||
"events": "./src/events",
|
||||
"locales": "./src/services/languages/locales"
|
||||
},
|
||||
"defaultLang": "en-US"
|
||||
}
|
|
@ -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));
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue