refactor: tidy directive parsing + queue status
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { normalizeCommandBody } from "./commands-registry.js";
|
||||
|
||||
export type SendPolicyOverride = "allow" | "deny";
|
||||
|
||||
export function normalizeSendPolicyOverride(
|
||||
@@ -17,11 +19,10 @@ export function parseSendPolicyCommand(raw?: string): {
|
||||
if (!raw) return { hasCommand: false };
|
||||
const trimmed = raw.trim();
|
||||
if (!trimmed) return { hasCommand: false };
|
||||
const match = trimmed.match(
|
||||
/^\/send(?:\s*:\s*([a-zA-Z]+)?\s*|\s+([a-zA-Z]+)\s*)?$/i,
|
||||
);
|
||||
const normalized = normalizeCommandBody(trimmed);
|
||||
const match = normalized.match(/^\/send(?:\s+([a-zA-Z]+))?\s*$/i);
|
||||
if (!match) return { hasCommand: false };
|
||||
const token = (match[1] ?? match[2])?.trim().toLowerCase();
|
||||
const token = match[1]?.trim().toLowerCase();
|
||||
if (!token) return { hasCommand: true };
|
||||
if (token === "inherit" || token === "default" || token === "reset") {
|
||||
return { hasCommand: true, mode: "inherit" };
|
||||
|
||||
Reference in New Issue
Block a user