From 792c48b498385471c8c89dd24756205ff4ede532 Mon Sep 17 00:00:00 2001 From: LTS20050703 Date: Mon, 5 Sep 2022 00:01:17 +0700 Subject: [PATCH] BREAKING: update channel types names (#2417) * update channel types names * fix ChannelTypes enum changes Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com> --- helpers/channels/threads/startThreadWithoutMessage.ts | 2 +- tests/channels/createNews.test.ts | 4 ++-- tests/channels/editChannelWithReason.test.ts | 8 ++++++-- tests/channels/invites/invite.test.ts | 4 ++-- types/shared.ts | 10 +++++----- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/helpers/channels/threads/startThreadWithoutMessage.ts b/helpers/channels/threads/startThreadWithoutMessage.ts index a404e8b12..6decdc4d1 100644 --- a/helpers/channels/threads/startThreadWithoutMessage.ts +++ b/helpers/channels/threads/startThreadWithoutMessage.ts @@ -35,7 +35,7 @@ export interface StartThreadWithoutMessage { /** The reason you are creating the thread */ reason?: string; /** the type of thread to create */ - type: ChannelTypes.GuildNewsThread | ChannelTypes.GuildPublicThread | ChannelTypes.GuildPrivateThread; + type: ChannelTypes.AnnouncementThread | ChannelTypes.PublicThread | ChannelTypes.PrivateThread; /** whether non-moderators can add other non-moderators to a thread; only available when creating a private thread */ invitable?: boolean; } diff --git a/tests/channels/createNews.test.ts b/tests/channels/createNews.test.ts index bccd5192a..500b50f8a 100644 --- a/tests/channels/createNews.test.ts +++ b/tests/channels/createNews.test.ts @@ -9,12 +9,12 @@ Deno.test({ const bot = loadBot(); const channel = await bot.helpers.createChannel(CACHED_COMMUNITY_GUILD_ID, { name: "Discordeno-test", - type: ChannelTypes.GuildNews, + type: ChannelTypes.GuildAnnouncement, }); // Assertions assertExists(channel); - assertEquals(channel.type, ChannelTypes.GuildNews); + assertEquals(channel.type, ChannelTypes.GuildAnnouncement); assertEquals(channel.topic, undefined); assertEquals(channel.bitrate, undefined); assertEquals(channel.userLimit, undefined); diff --git a/tests/channels/editChannelWithReason.test.ts b/tests/channels/editChannelWithReason.test.ts index 912bb0162..011e733bb 100644 --- a/tests/channels/editChannelWithReason.test.ts +++ b/tests/channels/editChannelWithReason.test.ts @@ -23,8 +23,12 @@ Deno.test({ // Change the channel to a news channel await t.step("[channel] change the channel to a news channel with a reason", async () => { - const editedChannel = await bot.helpers.editChannel(channel.id, { type: ChannelTypes.GuildNews }, "reason"); - assertEquals(editedChannel.type, ChannelTypes.GuildNews); + const editedChannel = await bot.helpers.editChannel( + channel.id, + { type: ChannelTypes.GuildAnnouncement }, + "reason", + ); + assertEquals(editedChannel.type, ChannelTypes.GuildAnnouncement); }); // Change from a news channel to a text channel diff --git a/tests/channels/invites/invite.test.ts b/tests/channels/invites/invite.test.ts index 3dd512336..4098e5d03 100644 --- a/tests/channels/invites/invite.test.ts +++ b/tests/channels/invites/invite.test.ts @@ -1,5 +1,5 @@ import { ChannelTypes } from "../../../mod.ts"; -import { assertEquals, assertExists, assertNotEquals } from "../../deps.ts"; +import { assertExists, assertNotEquals } from "../../deps.ts"; import { loadBot } from "../../mod.ts"; import { CACHED_COMMUNITY_GUILD_ID } from "../../utils.ts"; @@ -9,7 +9,7 @@ Deno.test({ const bot = loadBot(); const channel = await bot.helpers.createChannel(CACHED_COMMUNITY_GUILD_ID, { name: "Discordeno-test", - type: ChannelTypes.GuildNews, + type: ChannelTypes.GuildAnnouncement, }); // Assertions diff --git a/types/shared.ts b/types/shared.ts index 419020846..653929c7c 100644 --- a/types/shared.ts +++ b/types/shared.ts @@ -290,13 +290,13 @@ export enum ChannelTypes { /** An organizational category that contains up to 50 channels */ GuildCategory, /** A channel that users can follow and crosspost into their own server */ - GuildNews, - /** A temporary sub-channel within a GUILD_NEWS channel */ - GuildNewsThread = 10, + GuildAnnouncement, + /** A temporary sub-channel within a GUILD_ANNOUNCEMENT channel */ + AnnouncementThread = 10, /** A temporary sub-channel within a GUILD_TEXT channel */ - GuildPublicThread, + PublicThread, /** A temporary sub-channel within a GUILD_TEXT channel that is only viewable by those invited and those with the MANAGE_THREADS permission */ - GuildPrivateThread, + PrivateThread, /** A voice channel for hosting events with an audience */ GuildStageVoice, /** A channel in a hub containing the listed servers */