Split out of #441 to keep PRs reviewable.
Problem
voicechannels.category.name stores the Discord category as a name instead of an ID. It's read in ~10 places across src/services/voice-channel-manager.ts and src/services/channel-initializer.ts, each doing a name-based lookup:
const categoryName = await configService.getString("voicechannels.category.name") ||
await configService.getString("voice_channel.category_name") ||
await configService.getString("VC_CATEGORY_NAME", "Dynamic Voice Channels");
const category = guild.channels.cache.find(
(ch) => ch.type === ChannelType.GuildCategory && ch.name === categoryName,
);
Several sites also have legacy env-var fallback chains that need to come along. #439's selector UX needs this stored as an ID.
Proposed change
- Rename
voicechannels.category.name → voicechannels.category_id in ConfigSchema, defaultConfig, settingsMetadata.
- Extract a helper (e.g.,
resolveManagedCategory(guild, configService): Promise<CategoryChannel | null>) that does an ID-based guild.channels.cache.get(categoryId) lookup and validates the channel type. Place it next to the manager or in a small new module.
- Replace every call site (~10) with the helper.
- Drop the legacy env-var fallback chains — those values get translated by the existing
startupMigrator and won't be the source of truth post-migration.
- Hook into the shared name→ID startup migrator landing in the parent PR (the partial-implementation PR that lands
amikool.role_id and voicetracking.announcements.channel_id) — add voicechannels.category.name to its rename list, with a CategoryChannel resolver.
Acceptance
voicechannels.category.name removed from ConfigSchema; voicechannels.category_id added.
- All callers use the helper; no string
"voicechannels.category.name" left in src/.
- Migration successfully resolves stored names to IDs on first start after upgrade for deployments running pre-rename versions.
- Existing tests pass; new tests cover the helper's happy path (returns the cached category) and the missing-ID path (returns null with a warning).
Notes
Split out of #441 to keep PRs reviewable.
Problem
voicechannels.category.namestores the Discord category as a name instead of an ID. It's read in ~10 places acrosssrc/services/voice-channel-manager.tsandsrc/services/channel-initializer.ts, each doing a name-based lookup:Several sites also have legacy env-var fallback chains that need to come along. #439's selector UX needs this stored as an ID.
Proposed change
voicechannels.category.name→voicechannels.category_idinConfigSchema,defaultConfig,settingsMetadata.resolveManagedCategory(guild, configService): Promise<CategoryChannel | null>) that does an ID-basedguild.channels.cache.get(categoryId)lookup and validates the channel type. Place it next to the manager or in a small new module.startupMigratorand won't be the source of truth post-migration.amikool.role_idandvoicetracking.announcements.channel_id) — addvoicechannels.category.nameto its rename list, with aCategoryChannelresolver.Acceptance
voicechannels.category.nameremoved fromConfigSchema;voicechannels.category_idadded."voicechannels.category.name"left insrc/.Notes