mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-11 15:56:27 +02:00
loader add
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
const { readdirSync } = require("fs");
|
||||
|
||||
module.exports = async client => {
|
||||
|
||||
let count = 0;
|
||||
const dirsEvents = readdirSync("./events/");
|
||||
|
||||
for(const dirs of dirsEvents) {
|
||||
const filesDirs = readdirSync(`./events/${dirs}/`).filter(f => f.endsWith(".js"));
|
||||
for(const files of filesDirs) {
|
||||
const event = require(`../events/${dirs}/${files}`);
|
||||
if(dirs === "music") client.player.events.on(event.name, (...args) => event.run(client, ...args));
|
||||
else client.on(event.name, (...args) => event.run(client, ...args));
|
||||
count++;
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
console.log(`Event => ${count} chargé sur le bot`)
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user