From f615e8520ca11e5e9885fec663488eb8be4b26a9 Mon Sep 17 00:00:00 2001 From: LTS20050703 Date: Wed, 16 Nov 2022 03:37:03 +0700 Subject: [PATCH] helpers: add appliedTags to editHelper options (#2590) --- helpers/channels/editChannel.ts | 3 +++ plugins/permissions/src/channels/editChannel.ts | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/helpers/channels/editChannel.ts b/helpers/channels/editChannel.ts index 418bf89d8..13e884ccd 100644 --- a/helpers/channels/editChannel.ts +++ b/helpers/channels/editChannel.ts @@ -97,6 +97,7 @@ export async function editChannel(bot: Bot, channelId: BigString, options: Modif emoji_name: availableTag.emojiName, })) : undefined, + applied_tags: options.appliedTags?.map((appliedTag) => appliedTag.toString()), default_reaction_emoji: options.defaultReactionEmoji ? { emoji_id: options.defaultReactionEmoji.emojiId, @@ -215,6 +216,8 @@ export interface ModifyChannel extends WithReason { /** The unicode character of the emoji */ emojiName: string; }[]; + /** The IDs of the set of tags that have been applied to a thread in a GUILD_FORUM channel; limited to 5 */ + appliedTags?: BigString[]; /** the emoji to show in the add reaction button on a thread in a GUILD_FORUM channel */ defaultReactionEmoji?: { /** The id of a guild's custom emoji */ diff --git a/plugins/permissions/src/channels/editChannel.ts b/plugins/permissions/src/channels/editChannel.ts index ee071a948..d73a8553a 100644 --- a/plugins/permissions/src/channels/editChannel.ts +++ b/plugins/permissions/src/channels/editChannel.ts @@ -40,6 +40,8 @@ export function editChannel(bot: BotWithCache) { } else { perms.push("MANAGE_THREADS"); } + + if (options.appliedTags && options.appliedTags.length > 5) throw new Error("thread applied tags is limit to 5"); } else { perms.push("MANAGE_CHANNELS"); @@ -69,6 +71,10 @@ export function editChannel(bot: BotWithCache) { throw new Error("The parent id must be for a category channel type."); } } + + if (options.availableTags && options.availableTags.length > 20) { + throw new Error("channel available tags is limited to 20"); + } } requireBotChannelPermissions(bot, channel, perms);