UNPKG

fca-nazrul-remastered

Version:

Facebook-chat-api protect and deploy by Kanzu and HZI Team

25 lines (22 loc) 831 B
"use strict"; var { join } = require('path'); var fs = require('fs'); module.exports = function (defaultFuncs, api, ctx) { return function(Name, args){ var Method = {}; fs.readdirSync(join(__dirname, "../Func")).filter((/** @type {string} */File) => File.endsWith(".js") && !File.includes('Dev_')).map((/** @type {string} */File) => Method[File.split('.').slice(0, -1).join('.')] = require(`../Func/${File}`)(defaultFuncs, api, ctx)); if (Method[Name] == undefined) { return (`Method ${Name} not found`); } else { try { return Method[Name](args).then((/** @type {string} */Data) => { return Data; }); } catch (e) { console.log(e); } } }; };