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

Function buildPrefixUsage

src/utils/responseCoordinator.js:10–30  ·  view source on GitHub ↗
(prefix, commandData, validation)

Source from the content-addressed store, hash-verified

8}
9
10export function buildPrefixUsage(prefix, commandData, validation) {
11 const commandJson = getCommandJson(commandData);
12 const usageParts = [`${prefix}${commandJson.name}`];
13
14 if (validation.subcommandGroupName) {
15 usageParts.push(validation.subcommandGroupName);
16 }
17
18 if (validation.subcommandName) {
19 usageParts.push(validation.subcommandName);
20 } else if (!validation.subcommandGroupName && commandJson.options?.some((opt) => opt.type === 1)) {
21 usageParts.push('[subcommand]');
22 }
23
24 const optionDefs = validation.optionDefs || [];
25 for (const option of optionDefs) {
26 usageParts.push(`[${option.name}]`);
27 }
28
29 return usageParts.filter(Boolean).join(' ');
30}
31
32export class ResponseCoordinator {
33 constructor(interaction, { message = null } = {}) {

Callers 2

Calls 1

getCommandJsonFunction · 0.70

Tested by

no test coverage detected