mirror of
https://github.com/Ninluc/Dat_Boi.git
synced 2025-08-09 23:26:13 +02:00
Initial commit
This commit is contained in:
28
handlers/command.js
Executable file
28
handlers/command.js
Executable file
@ -0,0 +1,28 @@
|
||||
const { readdirSync } = require("fs");
|
||||
const ascii = require("ascii-table");
|
||||
let table = new ascii("Commands");
|
||||
table.setHeading("Command", "Load status");
|
||||
console.log("Welcome to SERVICE HANDLER".yellow);
|
||||
module.exports = (client) => {
|
||||
try{
|
||||
readdirSync("./commands/").forEach((dir) => {
|
||||
const commands = readdirSync(`./commands/${dir}/`).filter((file) => file.endsWith(".js"));
|
||||
for (let file of commands) {
|
||||
let pull = require(`../commands/${dir}/${file}`);
|
||||
if (pull.name) {
|
||||
client.commands.set(pull.name, pull);
|
||||
table.addRow(pull.name, "Ready");
|
||||
} else {
|
||||
table.addRow(file, `error->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().cyan);
|
||||
}catch (e){
|
||||
console.log(String(e.stack).bgRed)
|
||||
}
|
||||
};
|
||||
|
||||
/** Template by Tomato#6966 | https://github.com/Tomato6966/Discord-Js-Handler-Template */
|
Reference in New Issue
Block a user