mirror of https://github.com/openclaw/openclaw.git
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:
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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue