1
0
mirror of https://github.com/chylex/Discord-History-Tracker.git synced 2025-04-10 17:15:43 +02:00

Update database specifications and storage in the object

This commit is contained in:
chylex 2016-10-23 19:35:45 +02:00
parent 2ee1f6550b
commit 8112e5eda4

View File

@ -16,7 +16,7 @@
* <discord user id>, ...
* ],
*
* server: [
* servers: [
* {
* name: <server name>,
* type: <"SERVER"|"DM">
@ -25,7 +25,7 @@
*
* channels: {
* <discord channel id>: {
* server: <server index in the metadata.server array>,
* server: <server index in the meta.servers array>,
* name: <channel name>
* }, ...
* }
@ -53,14 +53,35 @@
* }, ...
* }
* }
*
*
* TEMPORARY OBJECT STRUCTURE
* ==========================
*
* {
* userlookup: {
* <discord user id>: <user index in the meta.userindex array>
* }
* }
*/
var SAVEFILE = function(){
this.db = {};
this.db.meta = {};
this.db.data = {};
this.meta = {};
this.meta.users = {};
this.meta.userindex = [];
this.meta.servers = [];
this.meta.channels = {};
this.data = {};
this.tmp = {};
this.tmp.userlookup = {};
};
};
SAVEFILE.prototype.toJson = function(){
return JSON.stringify(this.db);
return JSON.stringify({
meta: this.meta,
data: this.data
});
};