惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
A
About on SuperTechFans
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
N
Netflix TechBlog - Medium
Microsoft Security Blog
Microsoft Security Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
博客园 - 聂微东
博客园 - Franky
D
Docker
Martin Fowler
Martin Fowler
Engineering at Meta
Engineering at Meta
The Cloudflare Blog
人人都是产品经理
人人都是产品经理
Last Week in AI
Last Week in AI
U
Unit 42
F
Fortinet All Blogs
H
Help Net Security
Blog — PlanetScale
Blog — PlanetScale
Microsoft Azure Blog
Microsoft Azure Blog
罗磊的独立博客
P
Proofpoint News Feed
月光博客
月光博客
G
Google Developers Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(discord): honor threadName when sending to threads (#...
joshavant · 2026-05-15 · via Recent Commits to openclaw:main

@@ -1,3 +1,4 @@

1+

import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";

12

import {

23

assertMediaNotDataUrl,

34

jsonResult,

@@ -8,6 +9,7 @@ import {

89

resolvePollMaxSelections,

910

} from "../runtime-api.js";

1011

import { DiscordThreadInitialMessageError } from "../send.js";

12+

import { isThreadChannelType } from "../send.permissions.js";

1113

import type { DiscordSendComponents, DiscordSendEmbeds } from "../send.shared.js";

1214

import { discordMessagingActionRuntime } from "./runtime.messaging.runtime.js";

1315

import type { DiscordMessagingActionContext } from "./runtime.messaging.shared.js";

@@ -21,6 +23,69 @@ function hasDiscordComponentObjectKeys(value: unknown): value is Record<string,

2123

);

2224

}

232526+

async function appendDiscordThreadRenameResult(

27+

ctx: DiscordMessagingActionContext,

28+

params: {

29+

payload: Record<string, unknown>;

30+

target: string;

31+

threadName?: string;

32+

},

33+

) {

34+

const threadName = params.threadName?.trim();

35+

if (!threadName) {

36+

return params.payload;

37+

}

38+

if (!ctx.isActionEnabled("channels")) {

39+

return {

40+

...params.payload,

41+

warning: "Discord threadName was ignored because Discord channel management is disabled.",

42+

};

43+

}

44+45+

let channelId: string;

46+

try {

47+

channelId = discordMessagingActionRuntime.resolveDiscordChannelId(params.target);

48+

} catch {

49+

return {

50+

...params.payload,

51+

warning: "Discord threadName was ignored because the send target is not a channel/thread.",

52+

};

53+

}

54+55+

try {

56+

const channel = await discordMessagingActionRuntime.fetchChannelInfoDiscord(

57+

channelId,

58+

ctx.withOpts(),

59+

);

60+

if (!isThreadChannelType(channel.type)) {

61+

return {

62+

...params.payload,

63+

warning: "Discord threadName was ignored because the send target is not a thread.",

64+

};

65+

}

66+

const renamed = await discordMessagingActionRuntime.editChannelDiscord(

67+

{

68+

channelId,

69+

name: threadName,

70+

},

71+

ctx.withOpts(),

72+

);

73+

return {

74+

...params.payload,

75+

threadRename: {

76+

ok: true,

77+

channelId,

78+

name: renamed.name ?? threadName,

79+

},

80+

};

81+

} catch (error) {

82+

return {

83+

...params.payload,

84+

warning: `Discord message was sent, but thread rename failed: ${formatErrorMessage(error)}`,

85+

};

86+

}

87+

}

88+2489

export async function handleDiscordMessageSendAction(ctx: DiscordMessagingActionContext) {

2590

switch (ctx.action) {

2691

case "sticker": {

@@ -88,6 +153,7 @@ export async function handleDiscordMessageSendAction(ctx: DiscordMessagingAction

88153

});

89154

const filename = readStringParam(ctx.params, "filename");

90155

const replyTo = readStringParam(ctx.params, "replyTo");

156+

const threadName = readStringParam(ctx.params, "threadName");

91157

const rawEmbeds = ctx.params.embeds;

92158

const embeds: DiscordSendEmbeds | undefined = Array.isArray(rawEmbeds)

93159

? (rawEmbeds as DiscordSendEmbeds)

@@ -122,7 +188,13 @@ export async function handleDiscordMessageSendAction(ctx: DiscordMessagingAction

122188

mediaReadFile: ctx.options?.mediaReadFile,

123189

},

124190

);

125-

return jsonResult({ ok: true, result, components: true });

191+

return jsonResult(

192+

await appendDiscordThreadRenameResult(ctx, {

193+

payload: { ok: true, result, components: true },

194+

target: to,

195+

threadName,

196+

}),

197+

);

126198

}

127199128200

if (asVoice) {

@@ -142,7 +214,13 @@ export async function handleDiscordMessageSendAction(ctx: DiscordMessagingAction

142214

replyTo,

143215

silent,

144216

});

145-

return jsonResult({ ok: true, result, voiceMessage: true });

217+

return jsonResult(

218+

await appendDiscordThreadRenameResult(ctx, {

219+

payload: { ok: true, result, voiceMessage: true },

220+

target: to,

221+

threadName,

222+

}),

223+

);

146224

}

147225148226

const result = await discordMessagingActionRuntime.sendMessageDiscord(to, content ?? "", {

@@ -157,7 +235,13 @@ export async function handleDiscordMessageSendAction(ctx: DiscordMessagingAction

157235

embeds,

158236

silent,

159237

});

160-

return jsonResult({ ok: true, result });

238+

return jsonResult(

239+

await appendDiscordThreadRenameResult(ctx, {

240+

payload: { ok: true, result },

241+

target: to,

242+

threadName,

243+

}),

244+

);

161245

}

162246

case "threadCreate": {

163247

if (!ctx.isActionEnabled("threads")) {