diff --git a/packages/builders/__tests__/interactions/SlashCommands/SlashCommands.test.ts b/packages/builders/__tests__/interactions/SlashCommands/SlashCommands.test.ts
index 39f3a4546f75..0726d0d534be 100644
--- a/packages/builders/__tests__/interactions/SlashCommands/SlashCommands.test.ts
+++ b/packages/builders/__tests__/interactions/SlashCommands/SlashCommands.test.ts
@@ -234,7 +234,7 @@ describe('Slash Commands', () => {
expect(() => {
getBuilder().addChannelOption(
- getChannelOption().addChannelTypes(ChannelType.GuildNews, ChannelType.GuildText),
+ getChannelOption().addChannelTypes(ChannelType.GuildAnnouncement, ChannelType.GuildText),
);
}).not.toThrowError();
});
diff --git a/packages/builders/src/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.ts b/packages/builders/src/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.ts
index 847b7a84428f..dfa94b3c470e 100644
--- a/packages/builders/src/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.ts
+++ b/packages/builders/src/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.ts
@@ -6,10 +6,10 @@ const allowedChannelTypes = [
ChannelType.GuildText,
ChannelType.GuildVoice,
ChannelType.GuildCategory,
- ChannelType.GuildNews,
- ChannelType.GuildNewsThread,
- ChannelType.GuildPublicThread,
- ChannelType.GuildPrivateThread,
+ ChannelType.GuildAnnouncement,
+ ChannelType.AnnouncementThread,
+ ChannelType.PublicThread,
+ ChannelType.PrivateThread,
ChannelType.GuildStageVoice,
] as const;
diff --git a/packages/discord.js/src/managers/ThreadManager.js b/packages/discord.js/src/managers/ThreadManager.js
index 57f2dfd66133..f2662d862676 100644
--- a/packages/discord.js/src/managers/ThreadManager.js
+++ b/packages/discord.js/src/managers/ThreadManager.js
@@ -65,13 +65,13 @@ class ThreadManager extends CachedManager {
* @typedef {StartThreadOptions} ThreadCreateOptions
* @property {MessageResolvable} [startMessage] The message to start a thread from. If this is defined then type
* of thread gets automatically defined and cannot be changed. The provided `type` field will be ignored
- * @property {ChannelType.GuildNewsThread|ChannelType.GuildPublicThread|ChannelType.GuildPrivateThread} [type]
+ * @property {ChannelType.AnnouncementThread|ChannelType.PublicThread|ChannelType.PrivateThread} [type]
* The type of thread to create.
- * Defaults to {@link ChannelType.GuildPublicThread} if created in a {@link TextChannel}
+ * Defaults to {@link ChannelType.PublicThread} if created in a {@link TextChannel}
* When creating threads in a {@link NewsChannel} this is ignored and is always
- * {@link ChannelType.GuildNewsThread}
+ * {@link ChannelType.AnnouncementThread}
* @property {boolean} [invitable] Whether non-moderators can add other non-moderators to the thread
- * Can only be set when type will be {@link ChannelType.GuildPrivateThread}
+ * Can only be set when type will be {@link ChannelType.PrivateThread}
*/
/**
@@ -94,7 +94,7 @@ class ThreadManager extends CachedManager {
* .create({
* name: 'mod-talk',
* autoArchiveDuration: ThreadAutoArchiveDuration.OneHour,
- * type: ChannelType.GuildPrivateThread,
+ * type: ChannelType.PrivateThread,
* reason: 'Needed a separate thread for moderation',
* })
* .then(threadChannel => console.log(threadChannel))
@@ -113,12 +113,12 @@ class ThreadManager extends CachedManager {
throw new TypeError(ErrorCodes.InvalidType, 'type', 'ThreadChannelType or Number');
}
let resolvedType =
- this.channel.type === ChannelType.GuildNews ? ChannelType.GuildNewsThread : ChannelType.GuildPublicThread;
+ this.channel.type === ChannelType.GuildAnnouncement ? ChannelType.AnnouncementThread : ChannelType.PublicThread;
let startMessageId;
if (startMessage) {
startMessageId = this.channel.messages.resolveId(startMessage);
if (!startMessageId) throw new TypeError(ErrorCodes.InvalidType, 'startMessage', 'MessageResolvable');
- } else if (this.channel.type !== ChannelType.GuildNews) {
+ } else if (this.channel.type !== ChannelType.GuildAnnouncement) {
resolvedType = type ?? resolvedType;
}
@@ -127,7 +127,7 @@ class ThreadManager extends CachedManager {
name,
auto_archive_duration: autoArchiveDuration,
type: resolvedType,
- invitable: resolvedType === ChannelType.GuildPrivateThread ? invitable : undefined,
+ invitable: resolvedType === ChannelType.PrivateThread ? invitable : undefined,
rate_limit_per_user: rateLimitPerUser,
},
reason,
diff --git a/packages/discord.js/src/structures/BaseGuildTextChannel.js b/packages/discord.js/src/structures/BaseGuildTextChannel.js
index cb0f6ea93d64..12cad909249a 100644
--- a/packages/discord.js/src/structures/BaseGuildTextChannel.js
+++ b/packages/discord.js/src/structures/BaseGuildTextChannel.js
@@ -92,7 +92,7 @@ class BaseGuildTextChannel extends GuildChannel {
/**
* Sets the type of this channel.
* Only conversion between {@link TextChannel} and {@link NewsChannel} is supported.
- * @param {ChannelType.GuildText|ChannelType.GuildNews} type The new channel type
+ * @param {ChannelType.GuildText|ChannelType.GuildAnnouncement} type The new channel type
* @param {string} [reason] Reason for changing the channel's type
* @returns {Promise}
*/
diff --git a/packages/discord.js/src/structures/Guild.js b/packages/discord.js/src/structures/Guild.js
index 81f27296a38d..dd564ccacab0 100644
--- a/packages/discord.js/src/structures/Guild.js
+++ b/packages/discord.js/src/structures/Guild.js
@@ -1277,7 +1277,7 @@ class Guild extends AnonymousGuild {
*/
_sortedChannels(channel) {
const category = channel.type === ChannelType.GuildCategory;
- const channelTypes = [ChannelType.GuildText, ChannelType.GuildNews];
+ const channelTypes = [ChannelType.GuildText, ChannelType.GuildAnnouncement];
return discordSort(
this.channels.cache.filter(
c =>
diff --git a/packages/discord.js/src/structures/Message.js b/packages/discord.js/src/structures/Message.js
index 16d120a36701..efb48ea6a2a0 100644
--- a/packages/discord.js/src/structures/Message.js
+++ b/packages/discord.js/src/structures/Message.js
@@ -636,7 +636,7 @@ class Message extends Base {
(this.author.id === this.client.user.id ? PermissionsBitField.DefaultBit : PermissionFlagsBits.ManageMessages);
const { channel } = this;
return Boolean(
- channel?.type === ChannelType.GuildNews &&
+ channel?.type === ChannelType.GuildAnnouncement &&
!this.flags.has(MessageFlags.Crossposted) &&
this.type === MessageType.Default &&
channel.viewable &&
@@ -664,7 +664,7 @@ class Message extends Base {
* @returns {Promise}
* @example
* // Crosspost a message
- * if (message.channel.type === ChannelType.GuildNews) {
+ * if (message.channel.type === ChannelType.GuildAnnouncement) {
* message.crosspost()
* .then(() => console.log('Crossposted message'))
* .catch(console.error);
@@ -806,7 +806,7 @@ class Message extends Base {
*/
startThread(options = {}) {
if (!this.channel) return Promise.reject(new Error(ErrorCodes.ChannelNotCached));
- if (![ChannelType.GuildText, ChannelType.GuildNews].includes(this.channel.type)) {
+ if (![ChannelType.GuildText, ChannelType.GuildAnnouncement].includes(this.channel.type)) {
return Promise.reject(new Error(ErrorCodes.MessageThreadParent));
}
if (this.hasThread) return Promise.reject(new Error(ErrorCodes.MessageExistingThread));
diff --git a/packages/discord.js/src/structures/NewsChannel.js b/packages/discord.js/src/structures/NewsChannel.js
index 959551179339..09f7fcb75d4d 100644
--- a/packages/discord.js/src/structures/NewsChannel.js
+++ b/packages/discord.js/src/structures/NewsChannel.js
@@ -15,7 +15,7 @@ class NewsChannel extends BaseGuildTextChannel {
* @param {string} [reason] Reason for creating the webhook
* @returns {Promise}
* @example
- * if (channel.type === ChannelType.GuildNews) {
+ * if (channel.type === ChannelType.GuildAnnouncement) {
* channel.addFollower('222197033908436994', 'Important announcements')
* .then(() => console.log('Added follower'))
* .catch(console.error);
diff --git a/packages/discord.js/src/structures/ThreadChannel.js b/packages/discord.js/src/structures/ThreadChannel.js
index 00ef1ad3e6e6..b63db743efc0 100644
--- a/packages/discord.js/src/structures/ThreadChannel.js
+++ b/packages/discord.js/src/structures/ThreadChannel.js
@@ -80,7 +80,7 @@ class ThreadChannel extends BaseChannel {
* This property is always `null` in public threads.
* @type {?boolean}
*/
- this.invitable = this.type === ChannelType.GuildPrivateThread ? data.thread_metadata.invitable ?? false : null;
+ this.invitable = this.type === ChannelType.PrivateThread ? data.thread_metadata.invitable ?? false : null;
/**
* Whether the thread is archived
@@ -114,7 +114,7 @@ class ThreadChannel extends BaseChannel {
this.invitable ??= null;
}
- this._createdTimestamp ??= this.type === ChannelType.GuildPrivateThread ? super.createdTimestamp : null;
+ this._createdTimestamp ??= this.type === ChannelType.PrivateThread ? super.createdTimestamp : null;
if ('owner_id' in data) {
/**
@@ -301,7 +301,7 @@ class ThreadChannel extends BaseChannel {
* @property {boolean} [locked] Whether the thread is locked
* @property {boolean} [invitable] Whether non-moderators can add other non-moderators to a thread
* @property {string} [reason] Reason for editing the thread
- * Can only be edited on {@link ChannelType.GuildPrivateThread}
+ * Can only be edited on {@link ChannelType.PrivateThread}
*/
/**
@@ -322,7 +322,7 @@ class ThreadChannel extends BaseChannel {
auto_archive_duration: data.autoArchiveDuration,
rate_limit_per_user: data.rateLimitPerUser,
locked: data.locked,
- invitable: this.type === ChannelType.GuildPrivateThread ? data.invitable : undefined,
+ invitable: this.type === ChannelType.PrivateThread ? data.invitable : undefined,
},
reason: data.reason,
});
@@ -371,7 +371,7 @@ class ThreadChannel extends BaseChannel {
* @returns {Promise}
*/
setInvitable(invitable = true, reason) {
- if (this.type !== ChannelType.GuildPrivateThread) {
+ if (this.type !== ChannelType.PrivateThread) {
return Promise.reject(new RangeError(ErrorCodes.ThreadInvitableType, this.type));
}
return this.edit({ invitable, reason });
@@ -435,7 +435,7 @@ class ThreadChannel extends BaseChannel {
*/
get editable() {
return (
- (this.ownerId === this.client.user.id && (this.type !== ChannelType.GuildPrivateThread || this.joined)) ||
+ (this.ownerId === this.client.user.id && (this.type !== ChannelType.PrivateThread || this.joined)) ||
this.manageable
);
}
@@ -450,9 +450,7 @@ class ThreadChannel extends BaseChannel {
!this.archived &&
!this.joined &&
this.permissionsFor(this.client.user)?.has(
- this.type === ChannelType.GuildPrivateThread
- ? PermissionFlagsBits.ManageThreads
- : PermissionFlagsBits.ViewChannel,
+ this.type === ChannelType.PrivateThread ? PermissionFlagsBits.ManageThreads : PermissionFlagsBits.ViewChannel,
false,
)
);
@@ -500,7 +498,7 @@ class ThreadChannel extends BaseChannel {
return (
!(this.archived && this.locked && !this.manageable) &&
- (this.type !== ChannelType.GuildPrivateThread || this.joined || this.manageable) &&
+ (this.type !== ChannelType.PrivateThread || this.joined || this.manageable) &&
permissions.has(PermissionFlagsBits.SendMessagesInThreads, false) &&
this.guild.members.me.communicationDisabledUntilTimestamp < Date.now()
);
diff --git a/packages/discord.js/src/util/Channels.js b/packages/discord.js/src/util/Channels.js
index 07a69984615d..a1dc1de4222d 100644
--- a/packages/discord.js/src/util/Channels.js
+++ b/packages/discord.js/src/util/Channels.js
@@ -47,7 +47,7 @@ function createChannel(client, data, guild, { allowUnknownGuild, fromInteraction
channel = new (getCategoryChannel())(guild, data, client);
break;
}
- case ChannelType.GuildNews: {
+ case ChannelType.GuildAnnouncement: {
channel = new (getNewsChannel())(guild, data, client);
break;
}
@@ -55,9 +55,9 @@ function createChannel(client, data, guild, { allowUnknownGuild, fromInteraction
channel = new (getStageChannel())(guild, data, client);
break;
}
- case ChannelType.GuildNewsThread:
- case ChannelType.GuildPublicThread:
- case ChannelType.GuildPrivateThread: {
+ case ChannelType.AnnouncementThread:
+ case ChannelType.PublicThread:
+ case ChannelType.PrivateThread: {
channel = new (getThreadChannel())(guild, data, client, fromInteraction);
if (!allowUnknownGuild) channel.parent?.threads.cache.set(channel.id, channel);
break;
diff --git a/packages/discord.js/src/util/Constants.js b/packages/discord.js/src/util/Constants.js
index b9f3060b5ea8..61a5d191eac7 100644
--- a/packages/discord.js/src/util/Constants.js
+++ b/packages/discord.js/src/util/Constants.js
@@ -79,35 +79,31 @@ exports.NonSystemMessageTypes = [
* The types of channels that are text-based. The available types are:
* * {@link ChannelType.DM}
* * {@link ChannelType.GuildText}
- * * {@link ChannelType.GuildNews}
- * * {@link ChannelType.GuildNewsThread}
- * * {@link ChannelType.GuildPublicThread}
- * * {@link ChannelType.GuildPrivateThread}
+ * * {@link ChannelType.GuildAnnouncement}
+ * * {@link ChannelType.AnnouncementThread}
+ * * {@link ChannelType.PublicThread}
+ * * {@link ChannelType.PrivateThread}
* * {@link ChannelType.GuildVoice}
* @typedef {ChannelType[]} TextBasedChannelTypes
*/
exports.TextBasedChannelTypes = [
ChannelType.DM,
ChannelType.GuildText,
- ChannelType.GuildNews,
- ChannelType.GuildNewsThread,
- ChannelType.GuildPublicThread,
- ChannelType.GuildPrivateThread,
+ ChannelType.GuildAnnouncement,
+ ChannelType.AnnouncementThread,
+ ChannelType.PublicThread,
+ ChannelType.PrivateThread,
ChannelType.GuildVoice,
];
/**
* The types of channels that are threads. The available types are:
- * * {@link ChannelType.GuildNewsThread}
- * * {@link ChannelType.GuildPublicThread}
- * * {@link ChannelType.GuildPrivateThread}
+ * * {@link ChannelType.AnnouncementThread}
+ * * {@link ChannelType.PublicThread}
+ * * {@link ChannelType.PrivateThread}
* @typedef {ChannelType[]} ThreadChannelTypes
*/
-exports.ThreadChannelTypes = [
- ChannelType.GuildNewsThread,
- ChannelType.GuildPublicThread,
- ChannelType.GuildPrivateThread,
-];
+exports.ThreadChannelTypes = [ChannelType.AnnouncementThread, ChannelType.PublicThread, ChannelType.PrivateThread];
/**
* The types of channels that are voice-based. The available types are:
diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts
index 851211d2b980..4ceeb1d27844 100644
--- a/packages/discord.js/typings/index.d.ts
+++ b/packages/discord.js/typings/index.d.ts
@@ -517,7 +517,7 @@ export class BaseGuildTextChannel extends TextBasedChannelMixin(GuildChannel, tr
): Promise;
public setTopic(topic: string | null, reason?: string): Promise;
public setType(type: ChannelType.GuildText, reason?: string): Promise;
- public setType(type: ChannelType.GuildNews, reason?: string): Promise;
+ public setType(type: ChannelType.GuildAnnouncement, reason?: string): Promise;
}
export class BaseGuildVoiceChannel extends GuildChannel {
@@ -701,7 +701,7 @@ export class Embed {
}
export interface MappedChannelCategoryTypes {
- [ChannelType.GuildNews]: NewsChannel;
+ [ChannelType.GuildAnnouncement]: NewsChannel;
[ChannelType.GuildVoice]: VoiceChannel;
[ChannelType.GuildText]: TextChannel;
[ChannelType.GuildStageVoice]: StageChannel;
@@ -712,9 +712,9 @@ export type CategoryChannelType = Exclude<
ChannelType,
| ChannelType.DM
| ChannelType.GroupDM
- | ChannelType.GuildPublicThread
- | ChannelType.GuildNewsThread
- | ChannelType.GuildPrivateThread
+ | ChannelType.PublicThread
+ | ChannelType.AnnouncementThread
+ | ChannelType.PrivateThread
| ChannelType.GuildCategory
| ChannelType.GuildDirectory
>;
@@ -2019,7 +2019,7 @@ export class ModalSubmitInteraction extend
export class NewsChannel extends BaseGuildTextChannel {
public threads: ThreadManager;
- public type: ChannelType.GuildNews;
+ public type: ChannelType.GuildAnnouncement;
public addFollower(channel: TextChannelResolvable, reason?: string): Promise;
}
@@ -2496,13 +2496,13 @@ export class TextChannel extends BaseGuildTextChannel {
export type AnyThreadChannel = PublicThreadChannel | PrivateThreadChannel;
export interface PublicThreadChannel extends ThreadChannel {
- type: ChannelType.GuildPublicThread | ChannelType.GuildNewsThread;
+ type: ChannelType.PublicThread | ChannelType.AnnouncementThread;
}
export interface PrivateThreadChannel extends ThreadChannel {
get createdTimestamp(): number;
get createdAt(): Date;
- type: ChannelType.GuildPrivateThread;
+ type: ChannelType.PrivateThread;
}
export class ThreadChannel extends TextBasedChannelMixin(BaseChannel, true, [
@@ -3759,9 +3759,9 @@ export interface AddGuildMemberOptions {
export type AllowedPartial = User | Channel | GuildMember | Message | MessageReaction | ThreadMember;
-export type AllowedThreadTypeForNewsChannel = ChannelType.GuildNewsThread;
+export type AllowedThreadTypeForNewsChannel = ChannelType.AnnouncementThread;
-export type AllowedThreadTypeForTextChannel = ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread;
+export type AllowedThreadTypeForTextChannel = ChannelType.PublicThread | ChannelType.PrivateThread;
export interface BaseApplicationCommandData {
name: string;
@@ -4810,9 +4810,9 @@ export interface GuildChannelCreateOptions extends Omit;
}
@@ -4822,7 +4822,7 @@ export interface GuildChannelCloneOptions extends Omit extends StartThreadOptions {
startMessage?: MessageResolvable;
type?: AllowedThreadType;
- invitable?: AllowedThreadType extends ChannelType.GuildPrivateThread ? boolean : never;
+ invitable?: AllowedThreadType extends ChannelType.PrivateThread ? boolean : never;
}
export interface ThreadEditData {
diff --git a/packages/discord.js/typings/index.test-d.ts b/packages/discord.js/typings/index.test-d.ts
index 3ffaf2e5f9bb..394afc329e11 100644
--- a/packages/discord.js/typings/index.test-d.ts
+++ b/packages/discord.js/typings/index.test-d.ts
@@ -1042,7 +1042,7 @@ client.on('stickerUpdate', ({ client: oldClient }, { client: newClient }) => {
client.on('threadCreate', thread => {
expectType>(thread.client);
- if (thread.type === ChannelType.GuildPrivateThread) {
+ if (thread.type === ChannelType.PrivateThread) {
expectType(thread.createdTimestamp);
expectType(thread.createdAt);
} else {
@@ -1238,7 +1238,7 @@ expectType['send']>(voiceChannel.send);
expectAssignable(user);
expectAssignable(guildMember);
-expectType>(textChannel.setType(ChannelType.GuildNews));
+expectType>(textChannel.setType(ChannelType.GuildAnnouncement));
expectType>(newsChannel.setType(ChannelType.GuildText));
expectType(dmChannel.lastMessage);
@@ -1348,7 +1348,9 @@ declare const categoryChannelChildManager: CategoryChannelChildManager;
{
expectType>(categoryChannelChildManager.create({ name: 'name', type: ChannelType.GuildVoice }));
expectType>(categoryChannelChildManager.create({ name: 'name', type: ChannelType.GuildText }));
- expectType>(categoryChannelChildManager.create({ name: 'name', type: ChannelType.GuildNews }));
+ expectType>(
+ categoryChannelChildManager.create({ name: 'name', type: ChannelType.GuildAnnouncement }),
+ );
expectType>(
categoryChannelChildManager.create({ name: 'name', type: ChannelType.GuildStageVoice }),
);
@@ -1365,7 +1367,7 @@ declare const guildChannelManager: GuildChannelManager;
expectType>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildVoice }));
expectType>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildCategory }));
expectType>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildText }));
- expectType>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildNews }));
+ expectType>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildAnnouncement }));
expectType>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildStageVoice }));
expectType>>(guildChannelManager.fetch());
@@ -1839,9 +1841,9 @@ declare const NonThreadGuildBasedChannel: NonThreadGuildBasedChannel;
declare const GuildTextBasedChannel: GuildTextBasedChannel;
expectType(TextBasedChannel);
-expectType(
- TextBasedChannelTypes,
-);
+expectType<
+ ChannelType.GuildText | ChannelType.DM | ChannelType.GuildAnnouncement | ChannelType.GuildVoice | ThreadChannelType
+>(TextBasedChannelTypes);
expectType(VoiceBasedChannel);
expectType(GuildBasedChannel);
expectType(NonThreadGuildBasedChannel);