remove in plugins

This commit is contained in:
ChomeNS 2022-11-17 20:05:47 +07:00
parent 8ffd15d343
commit b6ab196a02

View file

@ -13,32 +13,18 @@ const path = require('path');
* @param {object} client proxy client
* @param {boolean} proxy is proxy
*/
async function loadPlugins(bot, dcclient, config, rl, targetClient, client, proxy) {
if (!proxy) {
const plugins = await fs.readdir(path.join(__dirname, '..', 'plugins'));
plugins.forEach((plugin) => {
if (!plugin.endsWith('.js')) return;
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));
}
});
} else {
const plugins = await fs.readdir(path.join(__dirname, '..', 'plugins', 'proxy'));
plugins.forEach((plugin) => {
if (!plugin.endsWith('.js')) return;
try {
const plug = require(path.join(__dirname, '..', 'plugins', 'proxy', plugin));
plug.inject(bot, client, targetClient, config);
} catch (e) {
console.log(`Proxy Plugin ${plugin} is having exception loading the plugin:`);
console.log(util.inspect(e));
}
});
}
async function loadPlugins(bot, dcclient, config, rl) {
const plugins = await fs.readdir(path.join(__dirname, '..', 'plugins'));
plugins.forEach((plugin) => {
if (!plugin.endsWith('.js')) return;
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};