fix(event): fixed not loading events

This commit is contained in:
Slincnik 2024-12-07 14:53:11 +03:00
parent 3d91b7fa9b
commit dc7bef73ee
No known key found for this signature in database
2 changed files with 20 additions and 14 deletions

View file

@ -12,6 +12,8 @@ export class ExtendedClient extends Client {
} }
async init() { async init() {
this.login(config.token).then(async () => await Promise.all([initCommands(), initEvents()]).catch(console.error)); return this.login(config.token)
.then(async () => await Promise.all([initCommands(), initEvents()]))
.catch(console.error);
} }
} }

View file

@ -11,6 +11,7 @@ export const init = async () => {
}; };
const buildEvents = async () => { const buildEvents = async () => {
try {
const eventFilePaths = (await getFilePaths("./newEvents", true)).filter(path => path.endsWith(".js")); const eventFilePaths = (await getFilePaths("./newEvents", true)).filter(path => path.endsWith(".js"));
for (const eventFilePath of eventFilePaths) { for (const eventFilePath of eventFilePaths) {
@ -28,6 +29,9 @@ const buildEvents = async () => {
events.push({ data, run }); events.push({ data, run });
} }
} catch (error) {
console.error("Error build events: ", error);
}
}; };
const registerEvents = () => { const registerEvents = () => {