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