diff --git a/dist/util/Config.js b/dist/util/Config.js
index 5c41d39a..bde6c735 100644
--- a/dist/util/Config.js
+++ b/dist/util/Config.js
@@ -1,23 +1,39 @@
"use strict";
-var __importDefault = (this && this.__importDefault) || function (mod) {
- return (mod && mod.__esModule) ? mod : { "default": mod };
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
+ __setModuleDefault(result, mod);
+ return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
-exports.DefaultOptions = void 0;
+exports.ConfigModel = exports.ConfigSchema = exports.DefaultOptions = void 0;
+const mongoose_1 = require("mongoose");
require("missing-native-js-functions");
-const Database_1 = __importDefault(require("./Database"));
-var Config;
+const Database_1 = __importStar(require("./Database"));
+var Config = new Database_1.MongooseCache(Database_1.default.collection("config"), [], { onlyEvents: false });
exports.default = {
- init: async function init(opts = exports.DefaultOptions) {
- Config = await Database_1.default.data.config({}).cache();
+ init: async function init() {
await Config.init();
- await Config.set(opts.merge(Config.cache || {}));
+ return this.setAll(Config.data.merge(exports.DefaultOptions));
},
getAll: function get() {
- return Config.get();
+ return Config.data;
},
setAll: function set(val) {
- return Config.set(val);
+ return Database_1.default.collection("config").updateOne({}, { $set: val });
},
};
exports.DefaultOptions = {
@@ -25,4 +41,10 @@ exports.DefaultOptions = {
gateway: {},
voice: {},
};
+exports.ConfigSchema = new mongoose_1.Schema({
+ api: Object,
+ gateway: Object,
+ voice: Object,
+});
+exports.ConfigModel = mongoose_1.model("Config", exports.ConfigSchema, "config");
//# sourceMappingURL=Config.js.map
\ No newline at end of file
|