mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-12-29 23:03:02 +05:00
fix(event): fixed not loading events
This commit is contained in:
parent
3d91b7fa9b
commit
dc7bef73ee
2 changed files with 20 additions and 14 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 = () => {
|
||||||
|
|
Loading…
Reference in a new issue