fix(discord): default standalone threads to public type (#14147)

When creating a Discord thread without a messageId (standalone thread),
the Discord API defaults to type 12 (private). Most users expect public.

- Default standalone non-forum threads to ChannelType.PublicThread (11)
- Add optional type field to DiscordThreadCreate for explicit control

Closes #14147
This commit is contained in:
Rain
2026-02-12 00:13:14 +08:00
committed by Shadow
parent 42f7538320
commit 9e92fc8fa1
2 changed files with 5 additions and 1 deletions

View File

@@ -114,7 +114,9 @@ describe("sendMessageDiscord", () => {
await createThreadDiscord("chan1", { name: "thread" }, { rest, token: "t" });
expect(postMock).toHaveBeenCalledWith(
Routes.threads("chan1"),
expect.objectContaining({ body: { name: "thread" } }),
expect.objectContaining({
body: expect.objectContaining({ name: "thread", type: ChannelType.PublicThread }),
}),
);
});

View File

@@ -72,6 +72,8 @@ export type DiscordThreadCreate = {
name: string;
autoArchiveMinutes?: number;
content?: string;
/** Discord thread type (default: PublicThread for standalone threads). */
type?: number;
};
export type DiscordThreadList = {