initial commit
This commit is contained in:
18
loaders/loadCommands.js
Normal file
18
loaders/loadCommands.js
Normal file
@ -0,0 +1,18 @@
|
||||
const { readdirSync } = require("fs");
|
||||
|
||||
module.exports = 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.name, command);
|
||||
count ++;
|
||||
};
|
||||
};
|
||||
|
||||
console.log(`[Commands] => ${count} logged commands`);
|
||||
}
|
18
loaders/loadEvents.js
Normal file
18
loaders/loadEvents.js
Normal file
@ -0,0 +1,18 @@
|
||||
const { readdirSync} = require("fs");
|
||||
|
||||
module.exports = 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}`);
|
||||
client.on(event.name, (...args) => event.run(client, ...args));
|
||||
count++;
|
||||
};
|
||||
};
|
||||
|
||||
console.log(`[Events] => ${count} logged events`)
|
||||
}
|
Reference in New Issue
Block a user