mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 23:18:28 +00:00
fix: normalize Discord autoThread reply target (#8302) (thanks @gavinbmoore)
This commit is contained in:
@@ -294,7 +294,9 @@ export async function resolveDiscordAutoThreadReplyPlan(params: {
|
||||
agentId: string;
|
||||
channel: string;
|
||||
}): Promise<DiscordAutoThreadReplyPlan> {
|
||||
const originalReplyTarget = `channel:${params.message.channelId}`;
|
||||
// Prefer the resolved thread channel ID when available so replies stay in-thread.
|
||||
const targetChannelId = params.threadChannel?.id ?? params.message.channelId;
|
||||
const originalReplyTarget = `channel:${targetChannelId}`;
|
||||
const createdThreadId = await maybeCreateDiscordAutoThread({
|
||||
client: params.client,
|
||||
message: params.message,
|
||||
@@ -391,17 +393,11 @@ export function resolveDiscordReplyDeliveryPlan(params: {
|
||||
let deliverTarget = originalReplyTarget;
|
||||
let replyTarget = originalReplyTarget;
|
||||
|
||||
// When a new thread was created, route to the new thread
|
||||
// When a new thread was created, route to the new thread.
|
||||
if (params.createdThreadId) {
|
||||
deliverTarget = `channel:${params.createdThreadId}`;
|
||||
replyTarget = deliverTarget;
|
||||
}
|
||||
// When in an existing thread (not newly created), ensure we route to the thread
|
||||
// This fixes #8278: autoThread replies sometimes going to root channel
|
||||
else if (params.threadChannel?.id) {
|
||||
deliverTarget = `channel:${params.threadChannel.id}`;
|
||||
replyTarget = deliverTarget;
|
||||
}
|
||||
const allowReference = deliverTarget === originalReplyTarget;
|
||||
const replyReference = createReplyReferencePlanner({
|
||||
replyToMode: allowReference ? params.replyToMode : "off",
|
||||
|
||||
Reference in New Issue
Block a user