Skip to content

Instantly share code, notes, and snippets.

@EveryDayRains
Created May 8, 2020 21:14
Show Gist options
  • Save EveryDayRains/33ed81b8f62f1582ff2a4b8314c8e59a to your computer and use it in GitHub Desktop.
Save EveryDayRains/33ed81b8f62f1582ff2a4b8314c8e59a to your computer and use it in GitHub Desktop.
хедлер команд
fs.readdir("./cmds/", (err, files) => {
if (err) console.log(err);
let jsfile = files.filter(f => f.split(".").pop() === "js");
if (jsfile.length <= 0) {
console.log("[BOOT | ERROR] Не найдено команд");
return;
}
jsfile.forEach((f, i) => {
let props = require(`./cmds/${f}`);
console.log(`[BOOT]${i + 1}.${f}| ✅`);
bot.commands.set(props.help.name, props);
props.help.aliases.forEach(alias => {
bot.aliases.set(alias, props.help.name);
})
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment