mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-14 03:20:49 +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;
|
||||
}
|
||||
|
||||
if (ctx.threadBinding?.threadId) {
|
||||
threadBindings.touchThread({ threadId: ctx.threadBinding.threadId });
|
||||
const boundThreadId = ctx.threadBinding?.conversation?.conversationId?.trim();
|
||||
if (boundThreadId && typeof threadBindings.touchThread === "function") {
|
||||
threadBindings.touchThread({ threadId: boundThreadId });
|
||||
}
|
||||
const ackReaction = resolveAckReaction(cfg, route.agentId, {
|
||||
channel: "discord",
|
||||
|
||||
@@ -20,6 +20,7 @@ export type DiscordThreadBindingLookupRecord = {
|
||||
|
||||
export type DiscordThreadBindingLookup = {
|
||||
listBySessionKey: (targetSessionKey: string) => DiscordThreadBindingLookupRecord[];
|
||||
touchThread?: (params: { threadId: string; at?: number; persist?: boolean }) => unknown;
|
||||
};
|
||||
|
||||
function resolveTargetChannelId(target: string): string | undefined {
|
||||
@@ -272,6 +273,6 @@ export async function deliverDiscordReply(params: {
|
||||
}
|
||||
|
||||
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",
|
||||
boundBy: "system",
|
||||
boundAt: Date.now(),
|
||||
lastActivityAt: Date.now(),
|
||||
label: "codex-thread",
|
||||
} satisfies ThreadBindingRecord;
|
||||
expect(resolveThreadBindingPersonaFromRecord(record)).toBe("⚙️ codex-thread");
|
||||
|
||||
Reference in New Issue
Block a user