Consolidate room leave/delete event handling into RoomManager emitter, remove redundant PLAYER_LEFT publishes from GameServer, and delete the chess game plugin (board, types, tests) in favor of the new plugin architecture. Add per-module CLAUDE.md files for leveling, guild-settings, feature-flags, db, api, and panel to improve agent navigability. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1.4 KiB
1.4 KiB
Guild Settings Module
updateSetting()uses a hardcodedkeyMapto map friendly key names to DB columns. Use exact key names (e.g.,"studentRole"not"studentRoleId"). Unknown keys throwUserError.- Type coercion per column: Discord IDs → BigInt automatically;
colorRoleIdsmust be array;featureOverridesmust be object;moderationDmOnWarnmust be boolean;moderationAutoTimeoutThresholdmust be number. Null values set columns to NULL. - Caching:
getGuildConfig()(inshared/lib/config.ts) caches transformed settings for 60 seconds. Every mutation (upsertSettings,updateSetting,addColorRole,removeColorRole) callsinvalidateGuildConfigCache(guildId)immediately. - If settings don't exist for a guild, the cache returns safe defaults — no errors thrown.
featureOverridesis a sparseRecord<string, boolean>— no keys are predefined. Consumers must check key existence.- No Discord validation: The service does not verify that role/channel IDs actually exist in Discord. Invalid IDs are stored silently.
addColorRole()/removeColorRole()fetch the full settings, mutate the array in JS, then upsert — this is not atomic and can race under concurrent requests.terminalMessageIdandterminalChannelIdare separate DB columns but grouped asterminal: { channelId, messageId }in the cached config. Setting one without the other can create orphaned data.