mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 06:27:27 +00:00
Discord: fix thread binding types in message/reply paths
This commit is contained in:
@@ -117,8 +117,9 @@ export async function processDiscordMessage(ctx: DiscordMessagePreflightContext)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx.threadBinding?.threadId) {
|
const boundThreadId = ctx.threadBinding?.conversation?.conversationId?.trim();
|
||||||
threadBindings.touchThread({ threadId: ctx.threadBinding.threadId });
|
if (boundThreadId && typeof threadBindings.touchThread === "function") {
|
||||||
|
threadBindings.touchThread({ threadId: boundThreadId });
|
||||||
}
|
}
|
||||||
const ackReaction = resolveAckReaction(cfg, route.agentId, {
|
const ackReaction = resolveAckReaction(cfg, route.agentId, {
|
||||||
channel: "discord",
|
channel: "discord",
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ export type DiscordThreadBindingLookupRecord = {
|
|||||||
|
|
||||||
export type DiscordThreadBindingLookup = {
|
export type DiscordThreadBindingLookup = {
|
||||||
listBySessionKey: (targetSessionKey: string) => DiscordThreadBindingLookupRecord[];
|
listBySessionKey: (targetSessionKey: string) => DiscordThreadBindingLookupRecord[];
|
||||||
|
touchThread?: (params: { threadId: string; at?: number; persist?: boolean }) => unknown;
|
||||||
};
|
};
|
||||||
|
|
||||||
function resolveTargetChannelId(target: string): string | undefined {
|
function resolveTargetChannelId(target: string): string | undefined {
|
||||||
@@ -272,6 +273,6 @@ export async function deliverDiscordReply(params: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (binding && deliveredAny) {
|
if (binding && deliveredAny) {
|
||||||
params.threadBindings?.touchThread({ threadId: binding.threadId });
|
params.threadBindings?.touchThread?.({ threadId: binding.threadId });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ describe("thread binding persona", () => {
|
|||||||
agentId: "codex",
|
agentId: "codex",
|
||||||
boundBy: "system",
|
boundBy: "system",
|
||||||
boundAt: Date.now(),
|
boundAt: Date.now(),
|
||||||
|
lastActivityAt: Date.now(),
|
||||||
label: "codex-thread",
|
label: "codex-thread",
|
||||||
} satisfies ThreadBindingRecord;
|
} satisfies ThreadBindingRecord;
|
||||||
expect(resolveThreadBindingPersonaFromRecord(record)).toBe("⚙️ codex-thread");
|
expect(resolveThreadBindingPersonaFromRecord(record)).toBe("⚙️ codex-thread");
|
||||||
|
|||||||
Reference in New Issue
Block a user