feat(discord): support forum tag edits via channel-edit (#12070) (thanks @xiaoyaner0201)

This commit is contained in:
Shadow
2026-02-20 21:14:27 -06:00
committed by Shadow
parent b7644d61a2
commit b294342d7f
7 changed files with 96 additions and 4 deletions

View File

@@ -1,6 +1,5 @@
import type { APIChannel } from "discord-api-types/v10";
import { Routes } from "discord-api-types/v10";
import { resolveDiscordRest } from "./send.shared.js";
import type {
DiscordChannelCreate,
DiscordChannelEdit,
@@ -8,6 +7,7 @@ import type {
DiscordChannelPermissionSet,
DiscordReactOpts,
} from "./send.types.js";
import { resolveDiscordRest } from "./send.shared.js";
export async function createChannelDiscord(
payload: DiscordChannelCreate,
@@ -70,6 +70,15 @@ export async function editChannelDiscord(
if (payload.autoArchiveDuration !== undefined) {
body.auto_archive_duration = payload.autoArchiveDuration;
}
if (payload.availableTags !== undefined) {
body.available_tags = payload.availableTags.map((t) => ({
...(t.id !== undefined && { id: t.id }),
name: t.name,
...(t.moderated !== undefined && { moderated: t.moderated }),
...(t.emoji_id !== undefined && { emoji_id: t.emoji_id }),
...(t.emoji_name !== undefined && { emoji_name: t.emoji_name }),
}));
}
return (await rest.patch(Routes.channel(payload.channelId), {
body,
})) as APIChannel;