mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-06-12 21:03:13 +08:00
30 lines
622 B
JavaScript
30 lines
622 B
JavaScript
const { config_file } = require('../utils');
|
|
|
|
const config = {
|
|
/**
|
|
* 原始设置
|
|
* @returns {Object}
|
|
*/
|
|
raw_config() {
|
|
delete require.cache[config_file];
|
|
return require(config_file)
|
|
},
|
|
/**
|
|
* @param {string} n
|
|
*/
|
|
updata(n) {
|
|
const new_config = this.raw_config()[`config_${n}`];
|
|
if (new_config) {
|
|
this.setObject(new_config)
|
|
}
|
|
},
|
|
init() {
|
|
this.setObject(this.raw_config()["default_config"])
|
|
},
|
|
setObject(o) {
|
|
Object.entries(o).forEach(([k, v]) => this[k] = v)
|
|
}
|
|
};
|
|
|
|
|
|
module.exports = config; |