mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-06 14:20:38 +02:00
loader add
This commit is contained in:
@@ -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`);
|
||||
}
|
||||
Reference in New Issue
Block a user