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

推荐订阅源

腾讯CDC
The Cloudflare Blog
IT之家
IT之家
V
V2EX
雷峰网
雷峰网
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
Stack Overflow Blog
Stack Overflow Blog
博客园 - Franky
Engineering at Meta
Engineering at Meta
S
SegmentFault 最新的问题
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 司徒正美
云风的 BLOG
云风的 BLOG
小众软件
小众软件
博客园 - 叶小钗
Blog — PlanetScale
Blog — PlanetScale
C
Check Point Blog
A
About on SuperTechFans
B
Blog
月光博客
月光博客
宝玉的分享
宝玉的分享
Last Week in AI
Last Week in AI

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
refactor(discord): share channel action param parsing · o...
steipete · 2026-04-23 · via Recent Commits to openclaw:main

@@ -1,6 +1,5 @@

11

import type { AgentToolResult } from "@mariozechner/pi-agent-core";

22

import {

3-

parseAvailableTags,

43

readNumberParam,

54

readStringArrayParam,

65

readStringParam,

@@ -12,6 +11,11 @@ import {

1211

isDiscordModerationAction,

1312

readDiscordModerationCommand,

1413

} from "./runtime.moderation-shared.js";

14+

import {

15+

readDiscordChannelCreateParams,

16+

readDiscordChannelEditParams,

17+

readDiscordChannelMoveParams,

18+

} from "./runtime.shared.js";

15191620

type Ctx = Pick<

1721

ChannelMessageActionContext,

@@ -21,9 +25,8 @@ type Ctx = Pick<

2125

export async function tryHandleDiscordMessageActionGuildAdmin(params: {

2226

ctx: Ctx;

2327

resolveChannelId: () => string;

24-

readParentIdParam: (params: Record<string, unknown>) => string | null | undefined;

2528

}): Promise<AgentToolResult<unknown> | undefined> {

26-

const { ctx, resolveChannelId, readParentIdParam } = params;

29+

const { ctx, resolveChannelId } = params;

2730

const { action, params: actionParams, cfg } = ctx;

2831

const accountId = ctx.accountId ?? readStringParam(actionParams, "accountId");

2932

@@ -154,25 +157,11 @@ export async function tryHandleDiscordMessageActionGuildAdmin(params: {

154157

const guildId = readStringParam(actionParams, "guildId", {

155158

required: true,

156159

});

157-

const name = readStringParam(actionParams, "name", { required: true });

158-

const type = readNumberParam(actionParams, "type", { integer: true });

159-

const parentId = readParentIdParam(actionParams);

160-

const topic = readStringParam(actionParams, "topic");

161-

const position = readNumberParam(actionParams, "position", {

162-

integer: true,

163-

});

164-

const nsfw = typeof actionParams.nsfw === "boolean" ? actionParams.nsfw : undefined;

165160

return await handleDiscordAction(

166161

{

167162

action: "channelCreate",

168163

accountId: accountId ?? undefined,

169-

guildId,

170-

name,

171-

type: type ?? undefined,

172-

parentId: parentId ?? undefined,

173-

topic: topic ?? undefined,

174-

position: position ?? undefined,

175-

nsfw,

164+

...readDiscordChannelCreateParams({ ...actionParams, guildId }),

176165

},

177166

cfg,

178167

);

@@ -182,37 +171,11 @@ export async function tryHandleDiscordMessageActionGuildAdmin(params: {

182171

const channelId = readStringParam(actionParams, "channelId", {

183172

required: true,

184173

});

185-

const name = readStringParam(actionParams, "name");

186-

const topic = readStringParam(actionParams, "topic");

187-

const position = readNumberParam(actionParams, "position", {

188-

integer: true,

189-

});

190-

const parentId = readParentIdParam(actionParams);

191-

const nsfw = typeof actionParams.nsfw === "boolean" ? actionParams.nsfw : undefined;

192-

const rateLimitPerUser = readNumberParam(actionParams, "rateLimitPerUser", {

193-

integer: true,

194-

});

195-

const archived = typeof actionParams.archived === "boolean" ? actionParams.archived : undefined;

196-

const locked = typeof actionParams.locked === "boolean" ? actionParams.locked : undefined;

197-

const autoArchiveDuration = readNumberParam(actionParams, "autoArchiveDuration", {

198-

integer: true,

199-

});

200-

const availableTags = parseAvailableTags(actionParams.availableTags);

201174

return await handleDiscordAction(

202175

{

203176

action: "channelEdit",

204177

accountId: accountId ?? undefined,

205-

channelId,

206-

name: name ?? undefined,

207-

topic: topic ?? undefined,

208-

position: position ?? undefined,

209-

parentId: parentId === undefined ? undefined : parentId,

210-

nsfw,

211-

rateLimitPerUser: rateLimitPerUser ?? undefined,

212-

archived,

213-

locked,

214-

autoArchiveDuration: autoArchiveDuration ?? undefined,

215-

availableTags,

178+

...readDiscordChannelEditParams({ ...actionParams, channelId }),

216179

},

217180

cfg,

218181

);

@@ -235,18 +198,11 @@ export async function tryHandleDiscordMessageActionGuildAdmin(params: {

235198

const channelId = readStringParam(actionParams, "channelId", {

236199

required: true,

237200

});

238-

const parentId = readParentIdParam(actionParams);

239-

const position = readNumberParam(actionParams, "position", {

240-

integer: true,

241-

});

242201

return await handleDiscordAction(

243202

{

244203

action: "channelMove",

245204

accountId: accountId ?? undefined,

246-

guildId,

247-

channelId,

248-

parentId: parentId === undefined ? undefined : parentId,

249-

position: position ?? undefined,

205+

...readDiscordChannelMoveParams({ ...actionParams, guildId, channelId }),

250206

},

251207

cfg,

252208

);