mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-30 23:50:22 +00:00
21 lines
472 B
TypeScript
21 lines
472 B
TypeScript
export function isDiscordMutableAllowEntry(raw: string): boolean {
|
|
const text = raw.trim();
|
|
if (!text || text === "*") {
|
|
return false;
|
|
}
|
|
|
|
const maybeMentionId = text.replace(/^<@!?/, "").replace(/>$/, "");
|
|
if (/^\d+$/.test(maybeMentionId)) {
|
|
return false;
|
|
}
|
|
|
|
for (const prefix of ["discord:", "user:", "pk:"]) {
|
|
if (!text.startsWith(prefix)) {
|
|
continue;
|
|
}
|
|
return text.slice(prefix.length).trim().length === 0;
|
|
}
|
|
|
|
return true;
|
|
}
|