mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-28 21:01:43 +03:00
fix(discord): respect replyToMode in thread channel
This commit is contained in:
@@ -29,6 +29,9 @@ export function createReplyReferencePlanner(options: {
|
|||||||
if (!allowReference) {
|
if (!allowReference) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
if (options.replyToMode === "off") {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
if (existingId) {
|
if (existingId) {
|
||||||
hasReplied = true;
|
hasReplied = true;
|
||||||
return existingId;
|
return existingId;
|
||||||
@@ -36,9 +39,6 @@ export function createReplyReferencePlanner(options: {
|
|||||||
if (!startId) {
|
if (!startId) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
if (options.replyToMode === "off") {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
if (options.replyToMode === "all") {
|
if (options.replyToMode === "all") {
|
||||||
hasReplied = true;
|
hasReplied = true;
|
||||||
return startId;
|
return startId;
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ describe("resolveDiscordReplyDeliveryPlan", () => {
|
|||||||
expect(plan.replyReference.use()).toBeUndefined();
|
expect(plan.replyReference.use()).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("always uses existingId when inside a thread", () => {
|
it("respects replyToMode off even inside a thread", () => {
|
||||||
const plan = resolveDiscordReplyDeliveryPlan({
|
const plan = resolveDiscordReplyDeliveryPlan({
|
||||||
replyTarget: "channel:thread",
|
replyTarget: "channel:thread",
|
||||||
replyToMode: "off",
|
replyToMode: "off",
|
||||||
@@ -82,6 +82,17 @@ describe("resolveDiscordReplyDeliveryPlan", () => {
|
|||||||
threadChannel: { id: "thread" },
|
threadChannel: { id: "thread" },
|
||||||
createdThreadId: null,
|
createdThreadId: null,
|
||||||
});
|
});
|
||||||
|
expect(plan.replyReference.use()).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("uses existingId when inside a thread with replyToMode all", () => {
|
||||||
|
const plan = resolveDiscordReplyDeliveryPlan({
|
||||||
|
replyTarget: "channel:thread",
|
||||||
|
replyToMode: "all",
|
||||||
|
messageId: "m1",
|
||||||
|
threadChannel: { id: "thread" },
|
||||||
|
createdThreadId: null,
|
||||||
|
});
|
||||||
expect(plan.replyReference.use()).toBe("m1");
|
expect(plan.replyReference.use()).toBe("m1");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user