1
0
Fork 0
mirror of https://github.com/ChomeNS/chomens-bot-mc.git synced 2024-12-19 11:52:20 -05:00
chomens-bot-js/util/load_files.js

20 lines
380 B
JavaScript
Raw Normal View History

2022-08-14 05:51:45 -04:00
const fs = require('fs')
const path = require('path')
function loadPlugins (directory) {
const plugins = []
for (const filename of fs.readdirSync(directory)) {
if (!filename.endsWith('.js')) continue
const filepath = path.join(directory, filename)
const plugin = require(filepath)
plugins.push(plugin)
}
return plugins
}
module.exports = loadPlugins