Files
aurorabot/shared/modules/guild-settings/AGENTS.md
syntaxbullet 6abbd4652a
Some checks failed
Deploy to Production / test (push) Failing after 33s
Refresh repository documentation
- Rewrite AGENTS and README files to match the current app layout
- Document API routes, trivia UI, and the active panel design language
2026-04-09 21:10:10 +02:00

1.1 KiB

Guild settings module

Responsibilities

  • store raw per-guild settings in guild_settings
  • convert DB rows to string-friendly objects for the API
  • support the cached runtime view returned by shared/lib/config.ts

Main methods

  • getSettings(guildId)
  • upsertSettings({ guildId, ...fields })
  • updateSetting(guildId, key, value)
  • deleteSettings(guildId)
  • addColorRole(guildId, roleId)
  • removeColorRole(guildId, roleId)

Runtime cache

  • shared/lib/config.ts caches getGuildConfig() results for 60 seconds
  • API writes invalidate that cache immediately
  • the cached runtime shape is not identical to the DB shape:
    • studentRoleId -> studentRole
    • visitorRoleId -> visitorRole
    • colorRoleIds -> colorRoles
    • terminal fields are grouped under terminal

Notes

  • updateSetting() accepts friendly keys like studentRole, welcomeChannel, and terminalMessage
  • Discord IDs are stored as bigint in the DB and exposed as strings from the service
  • addColorRole() and removeColorRole() read-modify-write the whole array, so they are not atomic under concurrent updates