MCPcopy Index your code
hub / github.com/codebymitch/TitanBot / normalizeGuildConfig

Function normalizeGuildConfig

src/utils/schemas.js:181–203  ·  view source on GitHub ↗
(raw, defaults = {})

Source from the content-addressed store, hash-verified

179}
180
181export function normalizeGuildConfig(raw, defaults = {}) {
182 const base = typeof raw === 'object' && raw !== null ? raw : {};
183 const merged = { ...defaults, ...base };
184
185 merged.logging = migrateLoggingConfig(merged.logging, {
186 logChannelId: merged.logChannelId,
187 reportChannelId: merged.reportChannelId,
188 enableLogging: merged.enableLogging,
189 logIgnore: merged.logIgnore,
190 });
191
192 const parsed = GuildConfigSchema.safeParse(merged);
193 const normalized = parsed.success ? parsed.data : { ...defaults, ...merged };
194
195 normalized.logging = migrateLoggingConfig(normalized.logging, {
196 logChannelId: normalized.logChannelId,
197 reportChannelId: normalized.reportChannelId,
198 enableLogging: normalized.enableLogging,
199 logIgnore: normalized.logIgnore,
200 });
201
202 return stripLegacyLoggingFields(normalized);
203}
204
205export function normalizeEconomyData(raw, defaults = {}) {
206 const base = typeof raw === 'object' && raw !== null ? raw : {};

Callers 3

getGuildConfigFunction · 0.90
guildConfig.jsFile · 0.90

Calls 2

migrateLoggingConfigFunction · 0.85
stripLegacyLoggingFieldsFunction · 0.85

Tested by

no test coverage detected