mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 04:37:27 +00:00
fix(discord): accept cid in agent component interactions
This commit is contained in:
@@ -414,12 +414,22 @@ function parseAgentComponentData(data: ComponentData): {
|
|||||||
if (!data || typeof data !== "object") {
|
if (!data || typeof data !== "object") {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Carbon parses "key:componentId=xxx" into { componentId: "xxx" }
|
||||||
|
// Components v2 / other builders may use { cid: "xxx" } (e.g. occomp:cid=xxx).
|
||||||
|
const raw =
|
||||||
|
("cid" in data
|
||||||
|
? (data as Record<string, unknown>).cid
|
||||||
|
: (data as Record<string, unknown>).componentId) ??
|
||||||
|
(data as Record<string, unknown>).componentId;
|
||||||
|
|
||||||
const componentId =
|
const componentId =
|
||||||
typeof data.componentId === "string"
|
typeof raw === "string"
|
||||||
? decodeURIComponent(data.componentId)
|
? decodeURIComponent(raw)
|
||||||
: typeof data.componentId === "number"
|
: typeof raw === "number"
|
||||||
? String(data.componentId)
|
? String(raw)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
if (!componentId) {
|
if (!componentId) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user