summary refs log tree commit diff
path: root/src/util/Config.ts
blob: b22e88e01e13afdc123de96f57c35a01859706cb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import "missing-native-js-functions";
import db from "./Database";
import { ProviderCache } from "lambert-db";
var Config: ProviderCache;

export default {
	init: async function init(opts: DefaultOptions = DefaultOptions) {
		Config = db.data.config({}).cache();
		await Config.init();
		await Config.set(opts.merge(Config.cache || {}));
	},
	getAll: function get() {
		return <DefaultOptions>Config.get();
	},
	setAll: function set(val: any) {
		return Config.set(val);
	},
};

export interface DefaultOptions {
	api?: any;
	gateway?: any;
	voice?: any;
}

export const DefaultOptions: DefaultOptions = {
	api: {},
	gateway: {},
	voice: {},
};