From 149db5b2c2a05b86bf16b5507ae4b3ce0793ea84 Mon Sep 17 00:00:00 2001 From: Shadow Date: Thu, 12 Feb 2026 16:31:06 -0600 Subject: [PATCH] Discord: handle thread edit params --- src/agents/tools/discord-actions-guild.ts | 11 ++++++ src/agents/tools/discord-actions.test.ts | 34 +++++++++++++++++++ .../discord/handle-action.guild-admin.ts | 8 +++++ src/discord/send.channels.ts | 9 +++++ src/discord/send.types.ts | 3 ++ 5 files changed, 65 insertions(+) diff --git a/src/agents/tools/discord-actions-guild.ts b/src/agents/tools/discord-actions-guild.ts index c6f2312ee5..beccd85551 100644 --- a/src/agents/tools/discord-actions-guild.ts +++ b/src/agents/tools/discord-actions-guild.ts @@ -322,6 +322,11 @@ export async function handleDiscordGuildAction( const rateLimitPerUser = readNumberParam(params, "rateLimitPerUser", { integer: true, }); + const archived = typeof params.archived === "boolean" ? params.archived : undefined; + const locked = typeof params.locked === "boolean" ? params.locked : undefined; + const autoArchiveDuration = readNumberParam(params, "autoArchiveDuration", { + integer: true, + }); const channel = accountId ? await editChannelDiscord( { @@ -332,6 +337,9 @@ export async function handleDiscordGuildAction( parentId, nsfw, rateLimitPerUser: rateLimitPerUser ?? undefined, + archived, + locked, + autoArchiveDuration: autoArchiveDuration ?? undefined, }, { accountId }, ) @@ -343,6 +351,9 @@ export async function handleDiscordGuildAction( parentId, nsfw, rateLimitPerUser: rateLimitPerUser ?? undefined, + archived, + locked, + autoArchiveDuration: autoArchiveDuration ?? undefined, }); return jsonResult({ ok: true, channel }); } diff --git a/src/agents/tools/discord-actions.test.ts b/src/agents/tools/discord-actions.test.ts index c156d0c57d..815e9a6c32 100644 --- a/src/agents/tools/discord-actions.test.ts +++ b/src/agents/tools/discord-actions.test.ts @@ -315,6 +315,34 @@ describe("handleDiscordGuildAction - channel management", () => { parentId: undefined, nsfw: undefined, rateLimitPerUser: undefined, + archived: undefined, + locked: undefined, + autoArchiveDuration: undefined, + }); + }); + + it("forwards thread edit fields", async () => { + await handleDiscordGuildAction( + "channelEdit", + { + channelId: "C1", + archived: true, + locked: false, + autoArchiveDuration: 1440, + }, + channelsEnabled, + ); + expect(editChannelDiscord).toHaveBeenCalledWith({ + channelId: "C1", + name: undefined, + topic: undefined, + position: undefined, + parentId: undefined, + nsfw: undefined, + rateLimitPerUser: undefined, + archived: true, + locked: false, + autoArchiveDuration: 1440, }); }); @@ -335,6 +363,9 @@ describe("handleDiscordGuildAction - channel management", () => { parentId: null, nsfw: undefined, rateLimitPerUser: undefined, + archived: undefined, + locked: undefined, + autoArchiveDuration: undefined, }); }); @@ -355,6 +386,9 @@ describe("handleDiscordGuildAction - channel management", () => { parentId: null, nsfw: undefined, rateLimitPerUser: undefined, + archived: undefined, + locked: undefined, + autoArchiveDuration: undefined, }); }); diff --git a/src/channels/plugins/actions/discord/handle-action.guild-admin.ts b/src/channels/plugins/actions/discord/handle-action.guild-admin.ts index bcffb7e97c..8f7ad54ba9 100644 --- a/src/channels/plugins/actions/discord/handle-action.guild-admin.ts +++ b/src/channels/plugins/actions/discord/handle-action.guild-admin.ts @@ -183,6 +183,11 @@ export async function tryHandleDiscordMessageActionGuildAdmin(params: { const rateLimitPerUser = readNumberParam(actionParams, "rateLimitPerUser", { integer: true, }); + const archived = typeof actionParams.archived === "boolean" ? actionParams.archived : undefined; + const locked = typeof actionParams.locked === "boolean" ? actionParams.locked : undefined; + const autoArchiveDuration = readNumberParam(actionParams, "autoArchiveDuration", { + integer: true, + }); return await handleDiscordAction( { action: "channelEdit", @@ -194,6 +199,9 @@ export async function tryHandleDiscordMessageActionGuildAdmin(params: { parentId: parentId === undefined ? undefined : parentId, nsfw, rateLimitPerUser: rateLimitPerUser ?? undefined, + archived, + locked, + autoArchiveDuration: autoArchiveDuration ?? undefined, }, cfg, ); diff --git a/src/discord/send.channels.ts b/src/discord/send.channels.ts index e832470604..3ad65e4583 100644 --- a/src/discord/send.channels.ts +++ b/src/discord/send.channels.ts @@ -61,6 +61,15 @@ export async function editChannelDiscord( if (payload.rateLimitPerUser !== undefined) { body.rate_limit_per_user = payload.rateLimitPerUser; } + if (payload.archived !== undefined) { + body.archived = payload.archived; + } + if (payload.locked !== undefined) { + body.locked = payload.locked; + } + if (payload.autoArchiveDuration !== undefined) { + body.auto_archive_duration = payload.autoArchiveDuration; + } return (await rest.patch(Routes.channel(payload.channelId), { body, })) as APIChannel; diff --git a/src/discord/send.types.ts b/src/discord/send.types.ts index 318a03002e..fa8b3b831b 100644 --- a/src/discord/send.types.ts +++ b/src/discord/send.types.ts @@ -142,6 +142,9 @@ export type DiscordChannelEdit = { parentId?: string | null; nsfw?: boolean; rateLimitPerUser?: number; + archived?: boolean; + locked?: boolean; + autoArchiveDuration?: number; }; export type DiscordChannelMove = {