mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 09:00:22 +00:00
fix(discord): preserve channel session keys via channel_id fallbacks (#17622)
* fix(discord): preserve channel session keys via channel_id fallbacks * docs(changelog): add discord session continuity note * Tests: cover discord channel_id fallback --------- Co-authored-by: Shadow <hi@shadowing.dev>
This commit is contained in:
@@ -59,6 +59,7 @@ async function createBaseContext(overrides: Record<string, unknown> = {}) {
|
||||
timestamp: new Date().toISOString(),
|
||||
attachments: [],
|
||||
},
|
||||
messageChannelId: "c1",
|
||||
author: {
|
||||
id: "U1",
|
||||
username: "alice",
|
||||
@@ -130,4 +131,25 @@ describe("processDiscordMessage ack reactions", () => {
|
||||
|
||||
expect(reactMessageDiscord).toHaveBeenCalledWith("c1", "m1", "👀", { rest: {} });
|
||||
});
|
||||
|
||||
it("uses preflight-resolved messageChannelId when message.channelId is missing", async () => {
|
||||
const ctx = await createBaseContext({
|
||||
message: {
|
||||
id: "m1",
|
||||
timestamp: new Date().toISOString(),
|
||||
attachments: [],
|
||||
},
|
||||
messageChannelId: "fallback-channel",
|
||||
shouldRequireMention: true,
|
||||
effectiveWasMentioned: true,
|
||||
sender: { label: "user" },
|
||||
});
|
||||
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
await processDiscordMessage(ctx as any);
|
||||
|
||||
expect(reactMessageDiscord).toHaveBeenCalledWith("fallback-channel", "m1", "👀", {
|
||||
rest: {},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user