mirror of
https://github.com/chylex/Discord-History-Tracker.git
synced 2025-06-04 09:31:05 +03:00
Add savefile.js with the database format specifications
This commit is contained in:
parent
00e951076e
commit
2ee1f6550b
66
src/tracker/savefile.js
Normal file
66
src/tracker/savefile.js
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* SAVEFILE STRUCTURE
|
||||
* ==================
|
||||
*
|
||||
* {
|
||||
* meta: {
|
||||
* users: {
|
||||
* <discord user id>: {
|
||||
* name: <user name>
|
||||
* }, ...
|
||||
* },
|
||||
*
|
||||
* // the user index is an array of discord user ids,
|
||||
* // these indexes are used in the message objects to save space
|
||||
* userindex: [
|
||||
* <discord user id>, ...
|
||||
* ],
|
||||
*
|
||||
* server: [
|
||||
* {
|
||||
* name: <server name>,
|
||||
* type: <"SERVER"|"DM">
|
||||
* }, ...
|
||||
* ],
|
||||
*
|
||||
* channels: {
|
||||
* <discord channel id>: {
|
||||
* server: <server index in the metadata.server array>,
|
||||
* name: <channel name>
|
||||
* }, ...
|
||||
* }
|
||||
* },
|
||||
*
|
||||
* data: {
|
||||
* <discord channel id>: {
|
||||
* <discord message id>: {
|
||||
* u: <user index of the sender>,
|
||||
* t: <message timestamp>,
|
||||
* m: <message content>,
|
||||
* f: <message flags>, // bit 1 = edited, bit 2 = has user mentions (omit for no flags),
|
||||
* e: [ // omit for no embeds
|
||||
* {
|
||||
* url: <embed url>,
|
||||
* type: <embed type>
|
||||
* }, ...
|
||||
* ],
|
||||
* a: [ // omit for no attachments
|
||||
* {
|
||||
* url: <attachment url>
|
||||
* }, ...
|
||||
* ]
|
||||
* }, ...
|
||||
* }, ...
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
|
||||
var SAVEFILE = function(){
|
||||
this.db = {};
|
||||
this.db.meta = {};
|
||||
this.db.data = {};
|
||||
};
|
||||
|
||||
SAVEFILE.prototype.toJson = function(){
|
||||
return JSON.stringify(this.db);
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user