Last active
March 15, 2021 17:59
-
-
Save EveryDayRains/468f66ca968d21baf3e550ee39d2b0fe to your computer and use it in GitHub Desktop.
Хандлер по категорям пример cmds/admin cmds/eco
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
const fs = require('fs') | |
fs.readdir('./cmds', (err, files) => { | |
if (err) console.log(err) | |
files.forEach((element,iterator) => { | |
if(!element.includes(".")) { | |
fs.readdir(`./cmds/${element}`,(err,sub_files)=>{ | |
sub_files.forEach((elem,iterator)=>{ | |
let props = require(`./cmds/${element}/${elem}`); | |
client.commands.set(props.help.name, props); | |
const alias = props.help.aliases | |
for (i = 0; i < alias.length; i++) { | |
client.aliases.set(alias[i], props); | |
} | |
console.log(`[BOOT]${props.help.name} ✅`) | |
}) | |
}) | |
} | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment