mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-19 18:39:20 -05: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),
|
||||
);
|
||||
},
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user