loader add

This commit is contained in:
VALOU3336
2024-02-13 21:45:11 +01:00
parent a0a674fcad
commit 804de4d5f0
6 changed files with 80 additions and 8 deletions
+19
View File
@@ -0,0 +1,19 @@
const { readdirSync } = require("fs");
module.exports = async client => {
let count = 0;
const dirsCommands = readdirSync("./commands/");
for(const dirs of dirsCommands) {
const filesDirs = readdirSync(`./commands/${dirs}/`).filter(f => f.endsWith(".js"));
for(const files of filesDirs) {
const command = require(`../commands/${dirs}/${files}`);
client.commands.set(command.data.name, command);
count++;
}
};
console.log(`[Commands Slash] => ${count} logged commands`);
}
+22
View File
@@ -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`)
};
+14
View File
@@ -0,0 +1,14 @@
const fs = require('fs');
const path = require('path');
module.exports = async (client) => {
const prefixCommandsPath = path.join(__dirname, '../commandprefix'); // Ajustez le chemin ici
const commandFiles = fs.readdirSync(prefixCommandsPath).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`../commandprefix/${file}`); // Ajustez le chemin ici
client.prefixCommands.set(command.name, command);
}
console.log(`[Prefix Commands] => ${client.prefixCommands.size} prefix commands loaded`);
};