-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Command.js
35 lines (24 loc) · 945 Bytes
/
Command.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
require('colors')
const {
readdirSync
} = require("fs");
const ascii = require("ascii-table");
let table = new ascii("Commands List".black);
table.setHeading("Commands".red, "Status".green);
module.exports = (client) => {
readdirSync("./source/").forEach(dir => {
const commands = readdirSync(`./source/${dir}/`).filter(file => file.endsWith(".js"));
for (let file of commands) {
let pull = require(`../source/${dir}/${file}`);
if (pull.name) {
client.commands.set(pull.name, pull);
table.addRow(file, '✅');
} else {
table.addRow(file, `❌ -> missing a help.name, or help.name is not a string.`);
continue;
}
if (pull.aliases && Array.isArray(pull.aliases)) pull.aliases.forEach(alias => client.aliases.set(alias, pull.name));
}
});
console.log(table.toString());
}