mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-12-23 09:53:18 +00:00
Update Datastore class
This commit is contained in:
parent
45e5019b28
commit
81a9d7be7c
@ -67,6 +67,7 @@ module.exports = class {
|
|||||||
|
|
||||||
|
|
||||||
checkEntry(id){
|
checkEntry(id){
|
||||||
|
this.loadEntry(id);
|
||||||
if(!this.map.has(id)){
|
if(!this.map.has(id)){
|
||||||
this.createEntry(id);
|
this.createEntry(id);
|
||||||
//this.showEntry(this.getEntry(id));
|
//this.showEntry(this.getEntry(id));
|
||||||
@ -85,6 +86,11 @@ module.exports = class {
|
|||||||
this.saveEntry(id, newData);
|
this.saveEntry(id, newData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadEntry(id){
|
||||||
|
const json = require(`../../../datastore/` + id + '.json');
|
||||||
|
this.map.set(id, json);
|
||||||
|
}
|
||||||
|
|
||||||
getEntry(id){
|
getEntry(id){
|
||||||
return this.map.get(id);
|
return this.map.get(id);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user