18 lines
378 B
JavaScript
18 lines
378 B
JavaScript
const fs = require("fs");
|
|
|
|
function getCommands() {
|
|
const commands = {};
|
|
const commandFiles = fs
|
|
.readdirSync("./commands")
|
|
.map((file) => file.replace(".js", ""));
|
|
|
|
for (let file of commandFiles) {
|
|
import(`../commands/${file}.js`).then(
|
|
(cmd) => (commands[file] = cmd.default.command)
|
|
);
|
|
}
|
|
|
|
return commands;
|
|
}
|
|
|
|
module.exports = { getCommands };
|