Skip to content

Commit

Permalink
[New] require all playerEvents and execute them!
Browse files Browse the repository at this point in the history
  • Loading branch information
naseif committed Aug 31, 2021
1 parent 8ce2a24 commit 98e904e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ for (const file of eventFiles) {
}
}

const botEvents = fs
.readdirSync("./playerEvents")
.filter((file) => file.endsWith(".js"));

for (const file of botEvents) {
const event = require(`./playerEvents/${file}`);
player.on(event.name, event.execute);
}

client.on("interactionCreate", async (interaction) => {
if (!interaction.isCommand()) return;

Expand Down

0 comments on commit 98e904e

Please sign in to comment.