Compare commits
No commits in common. "132d387e49379fa979bdf331c6f8fa649130c0ca" and "5b2fa020d18bc560a7cdd9d7d78c4e4a6be68eeb" have entirely different histories.
132d387e49
...
5b2fa020d1
1 changed files with 13 additions and 18 deletions
15
index.js
15
index.js
|
@ -41,13 +41,11 @@ async function loadCommandFromDir(dir) {
|
|||
|
||||
for (const file of commandFiles) {
|
||||
const filePath = path.join(commandsPath, file);
|
||||
import(filePath)
|
||||
.then(importedCommand => {
|
||||
const command = importedCommand.default;
|
||||
let command = await import(filePath);
|
||||
command = command.default;
|
||||
|
||||
client.commands.set(command.data.name, command);
|
||||
console.log(`Successfully loaded command \x1b[32m${command.category}/${command.data.name}\x1b[0m`);
|
||||
})
|
||||
.catch(error => console.error(`Failed to load command for path: ${filePath}`, error));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,16 +55,13 @@ async function loadEventFromDir(dir, listener) {
|
|||
|
||||
for (const file of eventFiles) {
|
||||
const filePath = path.join(eventsPath, file);
|
||||
import(filePath)
|
||||
.then(importedEvent => {
|
||||
const event = importedEvent.default;
|
||||
let event = await import(filePath);
|
||||
event = event.default;
|
||||
if (event.once) {
|
||||
listener.once(event.name, (...args) => event.execute(...args, client));
|
||||
}
|
||||
else {
|
||||
listener.on(event.name, (...args) => event.execute(...args, client));
|
||||
}
|
||||
})
|
||||
.catch(error => console.error(`Failed to load event for path: ${filePath}`, error));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue