(client, guildId, commandName, context = {})
| 239 | } |
| 240 | |
| 241 | export async function enableCommand(client, guildId, commandName, context = {}) { |
| 242 | const normalizedName = String(commandName || '').toLowerCase().trim(); |
| 243 | const target = resolveCommandTarget(client, normalizedName); |
| 244 | |
| 245 | if (!target) { |
| 246 | throw new Error(`Unknown command: \`${normalizedName}\`.`); |
| 247 | } |
| 248 | |
| 249 | const config = await getGuildConfig(client, guildId, context); |
| 250 | const disabledCommands = normalizeToggleRecord(config?.disabledCommands); |
| 251 | delete disabledCommands[normalizedName]; |
| 252 | |
| 253 | await persistAccessConfig(client, guildId, { disabledCommands }, context); |
| 254 | return { commandName: normalizedName, enabled: true }; |
| 255 | } |
| 256 | |
| 257 | export async function disableCategory(client, guildId, categoryKey, context = {}) { |
| 258 | const normalizedKey = normalizeCategoryKey(categoryKey); |
no test coverage detected