mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 13:07:39 +00:00
refactor: extract shared string normalization helpers
This commit is contained in:
@@ -1,17 +1,12 @@
|
||||
import type { MsgContext } from "../../auto-reply/templating.js";
|
||||
import { normalizeHyphenSlug } from "../../shared/string-normalization.js";
|
||||
import { listDeliverableMessageChannels } from "../../utils/message-channel.js";
|
||||
import type { GroupKeyResolution } from "./types.js";
|
||||
|
||||
const getGroupSurfaces = () => new Set<string>([...listDeliverableMessageChannels(), "webchat"]);
|
||||
|
||||
function normalizeGroupLabel(raw?: string) {
|
||||
const trimmed = raw?.trim().toLowerCase() ?? "";
|
||||
if (!trimmed) {
|
||||
return "";
|
||||
}
|
||||
const dashed = trimmed.replace(/\s+/g, "-");
|
||||
const cleaned = dashed.replace(/[^a-z0-9#@._+-]+/g, "-");
|
||||
return cleaned.replace(/-{2,}/g, "-").replace(/^[-.]+|[-.]+$/g, "");
|
||||
return normalizeHyphenSlug(raw);
|
||||
}
|
||||
|
||||
function shortenGroupId(value?: string) {
|
||||
|
||||
Reference in New Issue
Block a user