| 92 | } |
| 93 | |
| 94 | function normalizeCounter(counter, guildId) { |
| 95 | const normalized = { |
| 96 | id: String(counter.id), |
| 97 | type: String(counter.type), |
| 98 | channelId: String(counter.channelId), |
| 99 | guildId: String(counter.guildId || guildId), |
| 100 | createdAt: counter.createdAt || new Date().toISOString(), |
| 101 | enabled: typeof counter.enabled === 'boolean' ? counter.enabled : true |
| 102 | }; |
| 103 | |
| 104 | if (counter.updatedAt) { |
| 105 | normalized.updatedAt = counter.updatedAt; |
| 106 | } |
| 107 | |
| 108 | return normalized; |
| 109 | } |
| 110 | |
| 111 | function sanitizeCounters(counters, guildId) { |
| 112 | if (!Array.isArray(counters)) { |