Brozy123 commited on
Commit
a70c737
·
verified ·
1 Parent(s): ed684ff

Update storage.js

Browse files
Files changed (1) hide show
  1. storage.js +13 -9
storage.js CHANGED
@@ -58,28 +58,32 @@ class StorageManager {
58
  loadAll() {
59
  // Load Guild Settings
60
  const guildSettings = loadJson(GUILD_SETTINGS_FILE, {});
61
- this.data.config = guildSettings; // Keep IDs as strings
 
 
62
 
63
  // Load Roles
64
  const roles = loadJson(CONFIG_FILE, {});
65
- this.data.roles = {};
66
- for (const [id, roleList] of Object.entries(roles)) {
67
- this.data.roles[id] = new Set(roleList);
68
- }
69
 
70
  // Load Stats
71
  const stats = loadJson(PLAYER_STATS_FILE, {});
72
- this.data.stats = stats; // Keep IDs as strings
 
 
73
 
74
  // Load State
75
  const state = loadJson(STATE_FILE, {});
76
- this.data.active_polls = state.polls || {};
 
 
77
  this.data.processed_messages = new Set(state.processed || []);
78
 
79
- console.log('[STORAGE] Data loaded successfully with string-safe Snowflakes');
80
  }
81
 
82
-
83
  save(type) {
84
  switch (type) {
85
  case 'config':
 
58
  loadAll() {
59
  // Load Guild Settings
60
  const guildSettings = loadJson(GUILD_SETTINGS_FILE, {});
61
+ this.data.config = Object.fromEntries(
62
+ Object.entries(guildSettings).map(([k, v]) => [parseInt(k), v])
63
+ );
64
 
65
  // Load Roles
66
  const roles = loadJson(CONFIG_FILE, {});
67
+ this.data.roles = Object.fromEntries(
68
+ Object.entries(roles).map(([k, v]) => [parseInt(k), new Set(v)])
69
+ );
 
70
 
71
  // Load Stats
72
  const stats = loadJson(PLAYER_STATS_FILE, {});
73
+ this.data.stats = Object.fromEntries(
74
+ Object.entries(stats).map(([k, v]) => [parseInt(k), v])
75
+ );
76
 
77
  // Load State
78
  const state = loadJson(STATE_FILE, {});
79
+ this.data.active_polls = Object.fromEntries(
80
+ Object.entries(state.polls || {}).map(([k, v]) => [parseInt(k), v])
81
+ );
82
  this.data.processed_messages = new Set(state.processed || []);
83
 
84
+ console.log('[STORAGE] Data loaded successfully');
85
  }
86
 
 
87
  save(type) {
88
  switch (type) {
89
  case 'config':