MCPcopy Index your code
hub / github.com/codebymitch/TitanBot / enableCommand

Function enableCommand

src/services/commandAccessService.js:241–255  ·  view source on GitHub ↗
(client, guildId, commandName, context = {})

Source from the content-addressed store, hash-verified

239}
240
241export 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
257export async function disableCategory(client, guildId, categoryKey, context = {}) {
258 const normalizedKey = normalizeCategoryKey(categoryKey);

Callers 2

executeFunction · 0.90
handleDashboardComponentFunction · 0.90

Calls 4

getGuildConfigFunction · 0.90
resolveCommandTargetFunction · 0.85
normalizeToggleRecordFunction · 0.85
persistAccessConfigFunction · 0.85

Tested by

no test coverage detected