mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 18:08:27 +00:00
fix(discord): preserve DM lastRoute user target
This commit is contained in:
@@ -503,6 +503,8 @@ export async function processDiscordMessage(ctx: DiscordMessagePreflightContext)
|
||||
runtime.error?.(danger("discord: missing reply target"));
|
||||
return;
|
||||
}
|
||||
// Keep DM routes user-addressed so follow-up sends resolve direct session keys.
|
||||
const lastRouteTo = isDirectMessage ? `user:${author.id}` : effectiveTo;
|
||||
|
||||
const inboundHistory =
|
||||
shouldIncludeChannelHistory && historyLimit > 0
|
||||
@@ -553,15 +555,16 @@ export async function processDiscordMessage(ctx: DiscordMessagePreflightContext)
|
||||
OriginatingChannel: "discord" as const,
|
||||
OriginatingTo: autoThreadContext?.OriginatingTo ?? replyTarget,
|
||||
});
|
||||
const persistedSessionKey = ctxPayload.SessionKey ?? route.sessionKey;
|
||||
|
||||
await recordInboundSession({
|
||||
storePath,
|
||||
sessionKey: ctxPayload.SessionKey ?? route.sessionKey,
|
||||
sessionKey: persistedSessionKey,
|
||||
ctx: ctxPayload,
|
||||
updateLastRoute: {
|
||||
sessionKey: ctxPayload.SessionKey ?? route.sessionKey,
|
||||
sessionKey: persistedSessionKey,
|
||||
channel: "discord",
|
||||
to: effectiveTo,
|
||||
to: lastRouteTo,
|
||||
accountId: route.accountId,
|
||||
},
|
||||
onRecordError: (err) => {
|
||||
|
||||
Reference in New Issue
Block a user