mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 03:11:25 +00:00
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:
committed by
Peter Steinberger
parent
6931ca7035
commit
1fca7c3928
@@ -219,7 +219,17 @@ const DOCKS: Record<ChatChannelId, ChannelDock> = {
|
|||||||
String(entry),
|
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: {
|
groups: {
|
||||||
resolveRequireMention: resolveDiscordGroupRequireMention,
|
resolveRequireMention: resolveDiscordGroupRequireMention,
|
||||||
|
|||||||
Reference in New Issue
Block a user