let cachedTextAliasMap: Map<string, TextAliasSpec> | null = null;
let cachedTextAliasCommands: ChatCommandDefinition[] | null = null;
let cachedDetection: CommandDetection | undefined;
let cachedDetectionCommands: ChatCommandDefinition[] | null = null;
function getTextAliasMap(): Map<string, TextAliasSpec> { const commands = getChatCommands(); if (cachedTextAliasMap && cachedTextAliasCommands === commands) { return cachedTextAliasMap;
} const map = new Map<string, TextAliasSpec>(); for (const command of commands) { // Canonicalize to the primary text alias, not `/${key}`. Some command keys are // internal identifiers while the public text command is a dedicated alias. const canonical = normalizeOptionalString(command.textAliases[0]) || `/${command.key}`; const acceptsArgs = Boolean(command.acceptsArgs); for (const alias of command.textAliases) { const normalized = normalizeOptionalLowercaseString(alias); if (!normalized) { continue;
} if (!map.has(normalized)) {
map.set(normalized, { key: command.key, canonical, acceptsArgs });
}
}
}
cachedTextAliasMap = map;
cachedTextAliasCommands = commands; return map;
}
export function normalizeCommandBody(raw: string, options?: CommandNormalizeOptions): string { const trimmed = raw.trim(); if (!trimmed.startsWith("/")) { return trimmed;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.