mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-23 15:47:57 -05:00
19 lines
572 B
JavaScript
19 lines
572 B
JavaScript
const fs = require('fs/promises');
|
|
const util = require('util');
|
|
const path = require('path');
|
|
|
|
async function loadPlugins(bot, dcclient, config, rl) {
|
|
const plugins = await fs.readdir(path.join(__dirname, '..', 'plugins'));
|
|
|
|
plugins.forEach((plugin) => {
|
|
try {
|
|
const plug = require(path.join(__dirname, '..', 'plugins', plugin));
|
|
plug.inject(bot, dcclient, config, rl);
|
|
} catch (e) {
|
|
console.log(`Plugin ${plugin} is having exception loading the plugin:`);
|
|
console.log(util.inspect(e));
|
|
}
|
|
});
|
|
};
|
|
|
|
module.exports = {loadPlugins};
|