mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 10:31:24 +00:00
Discord: handle thread edit params
This commit is contained in:
@@ -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 });
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user