Merge d232434bf3 into da71eaebd2
This commit is contained in:
commit
90d23baa80
@ -25,11 +25,11 @@ type ParsedTtsCommand = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function parseTtsCommand(normalized: string): ParsedTtsCommand | null {
|
function parseTtsCommand(normalized: string): ParsedTtsCommand | null {
|
||||||
// Accept `/tts` and `/tts <action> [args]` as a single control surface.
|
// Accept `/tts <action> [args]` - return null for `/tts` alone to trigger inline menu.
|
||||||
if (normalized === "/tts") return { action: "status", args: "" };
|
if (normalized === "/tts") return null;
|
||||||
if (!normalized.startsWith("/tts ")) return null;
|
if (!normalized.startsWith("/tts ")) return null;
|
||||||
const rest = normalized.slice(5).trim();
|
const rest = normalized.slice(5).trim();
|
||||||
if (!rest) return { action: "status", args: "" };
|
if (!rest) return null;
|
||||||
const [action, ...tail] = rest.split(/\s+/);
|
const [action, ...tail] = rest.split(/\s+/);
|
||||||
return { action: action.toLowerCase(), args: tail.join(" ").trim() };
|
return { action: action.toLowerCase(), args: tail.join(" ").trim() };
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user