forgescript
Version:
ForgeScript is a comprehensive package that empowers you to effortlessly interact with Discord's API. It ensures scripting remains easy to learn and consistently effective.
36 lines • 1.3 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ForgeFunctionManager = void 0;
const ForgeFunction_1 = require("../structures/ForgeFunction");
const recursiveReaddirSync_1 = __importDefault(require("../functions/recursiveReaddirSync"));
class ForgeFunctionManager {
client;
functions = new Map();
constructor(client) {
this.client = client;
}
add(options) {
this.functions.set(options.name, new ForgeFunction_1.ForgeFunction(options));
}
get(name) {
return this.functions.get(name);
}
load(path) {
for (const file of (0, recursiveReaddirSync_1.default)(path).filter((x) => x.endsWith(".js"))) {
const data = require(file);
if (Object.keys(data).length === 0)
continue;
const req = (data.default ?? data);
if (req instanceof ForgeFunction_1.ForgeFunction) {
this.functions.set(req.data.name, req);
}
else
this.add(...req);
}
}
}
exports.ForgeFunctionManager = ForgeFunctionManager;
//# sourceMappingURL=ForgeFunctionManager.js.map
;