All checks were successful
ci/woodpecker/push/ci Pipeline was successful
Co-authored-by: Jason Woltje <jason@diversecanvas.com> Co-committed-by: Jason Woltje <jason@diversecanvas.com>
12 lines
312 B
TypeScript
12 lines
312 B
TypeScript
import type { ParsedCommand } from '@mosaic/types';
|
|
|
|
export function parseSlashCommand(input: string): ParsedCommand | null {
|
|
const match = input.match(/^\/([a-z][a-z0-9:_-]*)\s*(.*)?$/i);
|
|
if (!match) return null;
|
|
return {
|
|
command: match[1]!,
|
|
args: match[2]?.trim() || null,
|
|
raw: input,
|
|
};
|
|
}
|