diff --git a/src/helpers/channels/threads/editThread.ts b/src/helpers/channels/threads/editThread.ts deleted file mode 100644 index 72c93811c..000000000 --- a/src/helpers/channels/threads/editThread.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { ModifyThread } from "../../../types/channels/threads/modifyThread.ts"; -import type { Bot } from "../../../bot.ts"; -import { Channel } from "../../../types/channels/channel.ts"; -// import { channelToThread } from "../../../util/transformers/channel_to_thread.ts"; - -/** Update a thread's settings. Requires the `MANAGE_CHANNELS` permission for the guild. */ -export async function editThread(bot: Bot, threadId: bigint, options: ModifyThread, reason?: string) { - const result = await bot.rest.runMethod(bot.rest, "patch", bot.constants.endpoints.CHANNEL_BASE(threadId), { - name: options.name, - archived: options.archived, - auto_archive_duration: options.autoArchiveDuration, - locked: options.locked, - rate_limit_per_user: options.rateLimitPerUser, - reason, - }); - - return bot.transformers.channel(bot, { - channel: result, - guildId: result.guild_id ? bot.transformers.snowflake(result.guild_id) : undefined, - }); -} diff --git a/src/helpers/channels/threads/mod.ts b/src/helpers/channels/threads/mod.ts index 5b957b1d1..e348276f4 100644 --- a/src/helpers/channels/threads/mod.ts +++ b/src/helpers/channels/threads/mod.ts @@ -1,5 +1,4 @@ export * from "./addToThread.ts"; -export * from "./editThread.ts"; export * from "./getActiveThreads.ts"; export * from "./getArchivedThreads.ts"; export * from "./getThreadMembers.ts"; diff --git a/src/helpers/mod.ts b/src/helpers/mod.ts index 0b9dd2b0e..cc5880078 100644 --- a/src/helpers/mod.ts +++ b/src/helpers/mod.ts @@ -159,7 +159,6 @@ export * from "./channels/getStageInstance.ts"; export * from "./channels/deleteStageInstance.ts"; export * from "./voice/connectToVoiceChannel.ts"; export * from "./channels/threads/addToThread.ts"; -export * from "./channels/threads/editThread.ts"; export * from "./channels/threads/getActiveThreads.ts"; export * from "./channels/threads/getArchivedThreads.ts"; export * from "./channels/threads/getThreadMember.ts"; diff --git a/src/types/channels/modifyChannel.ts b/src/types/channels/modifyChannel.ts index 82d3f0b11..ca922380d 100644 --- a/src/types/channels/modifyChannel.ts +++ b/src/types/channels/modifyChannel.ts @@ -1,6 +1,5 @@ -import { SnakeCasedPropertiesDeep } from "../util.ts"; import { ChannelTypes } from "./channelTypes.ts"; -import { DiscordOverwrite, Overwrite } from "./overwrite.ts"; +import { Overwrite } from "./overwrite.ts"; import { VideoQualityModes } from "./videoQualityModes.ts"; export interface ModifyChannel { @@ -28,10 +27,12 @@ export interface ModifyChannel { rtcRegion?: string | null; /** The camera video quality mode of the voice channel */ videoQualityMode?: VideoQualityModes; -} - -/** https://discord.com/developers/docs/resources/channel#modify-channel */ -export interface DiscordModifyChannel extends SnakeCasedPropertiesDeep> { - // deno-lint-ignore camelcase - permission_overwrites?: DiscordOverwrite[]; + /** Whether the thread is archived */ + archived?: boolean; + /** Duration in minutes to automatically archive the thread after recent activity */ + autoArchiveDuration?: 60 | 1440 | 4320 | 10080; + /** When a thread is locked, only users with `MANAGE_THREADS` can unarchive it */ + locked?: boolean; + /** whether non-moderators can add other non-moderators to a thread; only available on private threads */ + invitable?: boolean; } diff --git a/tests/channels/threads.ts b/tests/channels/threads.ts index c2ff39cb5..cee559cdb 100644 --- a/tests/channels/threads.ts +++ b/tests/channels/threads.ts @@ -1,4 +1,4 @@ -import { assertEquals, assertExists, assertNotEquals, assertThrows } from "../deps.ts"; +import { assertEquals, assertExists, assertNotEquals } from "../deps.ts"; import { bot, guild } from "../mod.ts"; Deno.test("[thread] Start a thread", async (t) => { @@ -34,7 +34,7 @@ Deno.test("[thread] Start a thread", async (t) => { assertEquals(archived.members.size, 0); await t.step("[thread] Edit and archive a thread", async () => { - const edited = await bot.helpers.editThread(thread.id, { + const edited = await bot.helpers.editChannel(thread.id, { archived: true, name: "new name", autoArchiveDuration: 1440,