Rename loadNetModueles for consistency
This commit is contained in:
parent
1c56c7889f
commit
1bb6cf6f60
4 changed files with 7 additions and 7 deletions
19
util/reloadNetModules.js
Normal file
19
util/reloadNetModules.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
const fs = require('fs')
|
||||
const netloadDir = 'netload/'
|
||||
|
||||
|
||||
module.exports = function (client) {
|
||||
if (!fs.existsSync(netloadDir)) fs.mkdirSync(netloadDir);
|
||||
let commandFiles = fs.readdirSync(netloadDir).filter(file => file.endsWith('.js'));
|
||||
if (client.netmodules.size != 0) {
|
||||
for (const i of commandFiles) {
|
||||
delete require.cache[require.resolve(`../${netloadDir}${i}`)];
|
||||
}
|
||||
}
|
||||
client.netmodules.clear()
|
||||
for (const file of commandFiles) {
|
||||
const command = require(`../${netloadDir}${file}`);
|
||||
client.netmodules.set(command.name, command);
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue