fix(discord): strip user:/discord:/pk: prefixes in command allowFrom

Discord's formatAllowFrom now strips these prefixes before matching,
aligning with normalizeDiscordAllowList behavior used in DM admission.

Before: commands.allowFrom: ["user:123"] → no match (senderCandidates: ["123", "discord:123"])
After: commands.allowFrom: ["user:123"] → "123" → matches sender "123"

Fixes #17937
This commit is contained in:
Clawdbot
2026-02-16 13:19:30 +01:00
committed by Peter Steinberger
parent 6931ca7035
commit 1fca7c3928

View File

@@ -219,7 +219,17 @@ const DOCKS: Record<ChatChannelId, ChannelDock> = {
String(entry),
);
},
formatAllowFrom: ({ allowFrom }) => formatLower(allowFrom),
formatAllowFrom: ({ allowFrom }) =>
allowFrom
.map((entry) => String(entry).trim())
.filter(Boolean)
.map((entry) =>
entry
.replace(/^discord:/i, "")
.replace(/^user:/i, "")
.replace(/^pk:/i, "")
.toLowerCase(),
),
},
groups: {
resolveRequireMention: resolveDiscordGroupRequireMention,