mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 17:34:58 +00:00
fix: normalize delivery routing context
Co-authored-by: adam91holt <adam91holt@users.noreply.github.com>
This commit is contained in:
@@ -33,9 +33,19 @@ export async function resolveAnnounceTarget(params: {
|
||||
sessions.find((entry) => entry?.key === params.sessionKey) ??
|
||||
sessions.find((entry) => entry?.key === params.displayKey);
|
||||
|
||||
const channel = typeof match?.lastChannel === "string" ? match.lastChannel : undefined;
|
||||
const to = typeof match?.lastTo === "string" ? match.lastTo : undefined;
|
||||
const accountId = typeof match?.lastAccountId === "string" ? match.lastAccountId : undefined;
|
||||
const deliveryContext =
|
||||
match?.deliveryContext && typeof match.deliveryContext === "object"
|
||||
? (match.deliveryContext as Record<string, unknown>)
|
||||
: undefined;
|
||||
const channel =
|
||||
(typeof deliveryContext?.channel === "string" ? deliveryContext.channel : undefined) ??
|
||||
(typeof match?.lastChannel === "string" ? match.lastChannel : undefined);
|
||||
const to =
|
||||
(typeof deliveryContext?.to === "string" ? deliveryContext.to : undefined) ??
|
||||
(typeof match?.lastTo === "string" ? match.lastTo : undefined);
|
||||
const accountId =
|
||||
(typeof deliveryContext?.accountId === "string" ? deliveryContext.accountId : undefined) ??
|
||||
(typeof match?.lastAccountId === "string" ? match.lastAccountId : undefined);
|
||||
if (channel && to) return { channel, to, accountId };
|
||||
} catch {
|
||||
// ignore
|
||||
|
||||
Reference in New Issue
Block a user