Skip to content

Commit

Permalink
fix: Correção da execução dos events, os quais são estavam tendo suas…
Browse files Browse the repository at this point in the history
… informações resgatadas adequadamente.
  • Loading branch information
SouOWendel committed Sep 7, 2023
1 parent 8d199c2 commit 9ef17e6
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions Handlers/eventHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ export async function loadEvents(client) {
const files = fs.readdirSync(`./Events/${folder}`).filter((file) => file.endsWith('js'));

for (const file of files) {
const event = import(`../Events/${folder}/${file}`);
const event = await import(`../Events/${folder}/${file}`);

if (event.rest) {
if (event.once) {
client.rest.once(event.name, (...args) =>
event.execute(...args, client));
if (event.default.rest) {
if (event.default.once) {
client.rest.once(event.default.name, (...args) =>
event.default.execute(...args, client));
} else {
client.rest.on(event.name, (...args) =>
event.execute(...args, client));
client.rest.on(event.default.name, (...args) =>
event.default.execute(...args, client));
}
} else if (event.once) {
client.once(event.name, (...args) => event.execute(...args, client));
} else if (event.default.once) {
client.once(event.default.name, (...args) => event.default.execute(...args, client));
} else {
client.on(event.name, (...args) => event.execute(...args, client));
client.on(event.default.name, (...args) => event.default.execute(...args, client));
}
table.addRow(file, 'loaded');
continue;
Expand Down

0 comments on commit 9ef17e6

Please sign in to comment.