mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2025-07-05 23:00:49 +00:00
Update Datastore class
This commit is contained in:
@ -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);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user