twitch_bot/utils/commands.js
2023-02-01 23:11:48 +02:00

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 };