(client, guildId, categoryKey, context = {})
| 271 | } |
| 272 | |
| 273 | export async function enableCategory(client, guildId, categoryKey, context = {}) { |
| 274 | const normalizedKey = normalizeCategoryKey(categoryKey); |
| 275 | const category = getCategoryRegistry(client, normalizedKey); |
| 276 | |
| 277 | if (!category) { |
| 278 | throw new Error(`Unknown category: \`${categoryKey}\`.`); |
| 279 | } |
| 280 | |
| 281 | const config = await getGuildConfig(client, guildId, context); |
| 282 | const disabledCategories = normalizeToggleRecord(config?.disabledCategories); |
| 283 | delete disabledCategories[normalizedKey]; |
| 284 | |
| 285 | await persistAccessConfig(client, guildId, { disabledCategories }, context); |
| 286 | return { categoryKey: normalizedKey, displayName: category.displayName, enabled: true }; |
| 287 | } |
| 288 | |
| 289 | export async function resetCategoryCommands(client, guildId, categoryKey, context = {}) { |
| 290 | const normalizedKey = normalizeCategoryKey(categoryKey); |
no test coverage detected