openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
22 lines (21 loc) • 749 B
JavaScript
import { c as normalizeOptionalLowercaseString } from "./string-coerce-CCIiB4H7.mjs";
//#region src/auto-reply/group-activation.ts
function normalizeGroupActivation(e) {
const t = normalizeOptionalLowercaseString(e);
return t === "mention" || t === "always" ? t : void 0;
}
function parseActivationCommand(e) {
const t = e?.trim();
if (!t) return { hasCommand: false };
const n = t.replace(/^\/([^\s:]+)\s*:(.*)$/, (e, t, n) => {
const r = n.trimStart();
return r ? `/${t} ${r}` : `/${t}`;
}).match(/^\/activation(?:\s+([a-zA-Z]+))?\s*$/i);
if (!n) return { hasCommand: false };
return {
hasCommand: true,
mode: normalizeGroupActivation(n[1])
};
}
//#endregion
export { parseActivationCommand as n, normalizeGroupActivation as t };