(client, guildId, categoryKey, context = {})
| 287 | } |
| 288 | |
| 289 | export async function resetCategoryCommands(client, guildId, categoryKey, context = {}) { |
| 290 | const normalizedKey = normalizeCategoryKey(categoryKey); |
| 291 | const category = getCategoryRegistry(client, normalizedKey); |
| 292 | |
| 293 | if (!category) { |
| 294 | throw new Error(`Unknown category: \`${categoryKey}\`.`); |
| 295 | } |
| 296 | |
| 297 | const config = await getGuildConfig(client, guildId, context); |
| 298 | const disabledCommands = normalizeToggleRecord(config?.disabledCommands); |
| 299 | |
| 300 | for (const command of category.commands) { |
| 301 | delete disabledCommands[command.name.toLowerCase()]; |
| 302 | } |
| 303 | |
| 304 | await persistAccessConfig(client, guildId, { disabledCommands }, context); |
| 305 | return { categoryKey: normalizedKey, displayName: category.displayName }; |
| 306 | } |
| 307 | |
| 308 | export function resolveCategoryChoice(client, input) { |
| 309 | if (!input) { |
no test coverage detected