Created
May 8, 2020 21:14
-
-
Save EveryDayRains/33ed81b8f62f1582ff2a4b8314c8e59a to your computer and use it in GitHub Desktop.
хедлер команд
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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