-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathcommandHandler.js
More file actions
24 lines (22 loc) · 817 Bytes
/
commandHandler.js
File metadata and controls
24 lines (22 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const ascii = require("ascii-table");
const commandCheck = require("./../utils/commandCheck");
const table = new ascii().setHeading("command", "Load Status");
module.exports = async (err, files, client) => {
if (err) return console.error(err);
files.forEach((file, index) => {
const command = require(`./../commands/${file}`);
if (commandCheck(command.name, command)) {
if (command.name) {
client.commands.set(command.name, command);
table.addRow(command.name, "✔");
if (command.aliases && Array.isArray(command))
command.aliases.foreach((alias) =>
client.aliases.set(alias, command.name)
);
} else {
table.addRow(command.name, "✖");
}
}
if (index == files.length - 1) console.log(table.toString());
});
};