diff --git a/packages/discord.js/src/client/actions/ThreadListSync.js b/packages/discord.js/src/client/actions/ThreadListSync.js index b16fb85a5..51e6ff292 100644 --- a/packages/discord.js/src/client/actions/ThreadListSync.js +++ b/packages/discord.js/src/client/actions/ThreadListSync.js @@ -36,7 +36,7 @@ class ThreadListSyncAction extends Action { } /** - * Emitted whenever the client user gains access to a text or news channel that contains threads + * Emitted whenever the client user gains access to a text or announcement channel that contains threads * @event Client#threadListSync * @param {Collection} threads The threads that were synced * @param {Guild} guild The guild that the threads were synced in diff --git a/packages/discord.js/src/client/actions/WebhooksUpdate.js b/packages/discord.js/src/client/actions/WebhooksUpdate.js index 3e3c46aff..53dbfc175 100644 --- a/packages/discord.js/src/client/actions/WebhooksUpdate.js +++ b/packages/discord.js/src/client/actions/WebhooksUpdate.js @@ -12,7 +12,7 @@ class WebhooksUpdate extends Action { /** * Emitted whenever a channel has its webhooks changed. * @event Client#webhooksUpdate - * @param {TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel|MediaChannel} channel + * @param {TextChannel|AnnouncementChannel|VoiceChannel|StageChannel|ForumChannel|MediaChannel} channel * The channel that had a webhook update */ client.emit(Events.WebhooksUpdate, channel); diff --git a/packages/discord.js/src/errors/Messages.js b/packages/discord.js/src/errors/Messages.js index 41e81dd34..2ee1ab340 100644 --- a/packages/discord.js/src/errors/Messages.js +++ b/packages/discord.js/src/errors/Messages.js @@ -75,7 +75,7 @@ const Messages = { [DjsErrorCodes.InvalidType]: (name, expected, an = false) => `Supplied ${name} is not a${an ? 'n' : ''} ${expected}.`, [DjsErrorCodes.InvalidElement]: (type, name, elem) => `Supplied ${type} ${name} includes an invalid element: ${elem}`, - [DjsErrorCodes.MessageThreadParent]: 'The message was not sent in a guild text or news channel', + [DjsErrorCodes.MessageThreadParent]: 'The message was not sent in a guild text or announcement channel', [DjsErrorCodes.MessageExistingThread]: 'The message already has a thread', [DjsErrorCodes.ThreadInvitableType]: type => `Invitable cannot be edited on ${type}`, diff --git a/packages/discord.js/src/index.js b/packages/discord.js/src/index.js index 4297f221b..cdedc8aa4 100644 --- a/packages/discord.js/src/index.js +++ b/packages/discord.js/src/index.js @@ -161,7 +161,7 @@ exports.MessagePayload = require('./structures/MessagePayload'); exports.MessageReaction = require('./structures/MessageReaction'); exports.ModalSubmitInteraction = require('./structures/ModalSubmitInteraction'); exports.ModalSubmitFields = require('./structures/ModalSubmitFields'); -exports.NewsChannel = require('./structures/NewsChannel'); +exports.AnnouncementChannel = require('./structures/AnnouncementChannel.js'); exports.OAuth2Guild = require('./structures/OAuth2Guild'); exports.PartialGroupDMChannel = require('./structures/PartialGroupDMChannel'); exports.PermissionOverwrites = require('./structures/PermissionOverwrites'); diff --git a/packages/discord.js/src/managers/GuildChannelManager.js b/packages/discord.js/src/managers/GuildChannelManager.js index 61209f39d..b981801b6 100644 --- a/packages/discord.js/src/managers/GuildChannelManager.js +++ b/packages/discord.js/src/managers/GuildChannelManager.js @@ -99,15 +99,15 @@ class GuildChannelManager extends CachedManager { } /** - * Data that can be resolved to a News Channel object. This can be: - * * A NewsChannel object + * Data that can be resolved to an Announcement Channel object. This can be: + * * An Announcement Channel object * * A Snowflake - * @typedef {NewsChannel|Snowflake} NewsChannelResolvable + * @typedef {AnnouncementChannel|Snowflake} AnnouncementChannelResolvable */ /** * Adds the target channel to a channel's followers. - * @param {NewsChannelResolvable} channel The channel to follow + * @param {AnnouncementChannelResolvable} channel The channel to follow * @param {TextChannelResolvable} targetChannel The channel where published announcements will be posted at * @param {string} [reason] Reason for creating the webhook * @returns {Promise} Returns created target webhook id. @@ -115,7 +115,7 @@ class GuildChannelManager extends CachedManager { async addFollower(channel, targetChannel, reason) { const channelId = this.resolveId(channel); if (!channelId) { - throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'channel', 'NewsChannelResolvable'); + throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'channel', 'AnnouncementChannelResolvable'); } const targetChannelId = this.resolveId(targetChannel); if (!targetChannelId) { @@ -208,7 +208,7 @@ class GuildChannelManager extends CachedManager { /** * @typedef {ChannelWebhookCreateOptions} WebhookCreateOptions - * @property {TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel|MediaChannel|Snowflake} channel + * @property {TextChannel|AnnouncementChannel|VoiceChannel|StageChannel|ForumChannel|MediaChannel|Snowflake} channel * The channel to create the webhook for */ @@ -247,7 +247,7 @@ class GuildChannelManager extends CachedManager { * Options used to edit a guild channel. * @typedef {Object} GuildChannelEditOptions * @property {string} [name] The name of the channel - * @property {ChannelType} [type] The type of the channel (only conversion between text and news is supported) + * @property {ChannelType} [type] The type of the channel (only conversion between text and announcement is supported) * @property {number} [position] The position of the channel * @property {?string} [topic] The topic of the text channel * @property {boolean} [nsfw] Whether the channel is NSFW diff --git a/packages/discord.js/src/managers/GuildInviteManager.js b/packages/discord.js/src/managers/GuildInviteManager.js index 93b0c973a..641cf53ff 100644 --- a/packages/discord.js/src/managers/GuildInviteManager.js +++ b/packages/discord.js/src/managers/GuildInviteManager.js @@ -43,12 +43,12 @@ class GuildInviteManager extends CachedManager { * Data that can be resolved to a channel that an invite can be created on. This can be: * * TextChannel * * VoiceChannel - * * NewsChannel + * * AnnouncementChannel * * StageChannel * * ForumChannel * * MediaChannel * * Snowflake - * @typedef {TextChannel|VoiceChannel|NewsChannel|StageChannel|ForumChannel|MediaChannel|Snowflake} + * @typedef {TextChannel|VoiceChannel|AnnouncementChannel|StageChannel|ForumChannel|MediaChannel|Snowflake} * GuildInvitableChannelResolvable */ diff --git a/packages/discord.js/src/managers/GuildTextThreadManager.js b/packages/discord.js/src/managers/GuildTextThreadManager.js index 9fdcd7141..84c6a3419 100644 --- a/packages/discord.js/src/managers/GuildTextThreadManager.js +++ b/packages/discord.js/src/managers/GuildTextThreadManager.js @@ -12,7 +12,7 @@ class GuildTextThreadManager extends ThreadManager { /** * The channel this Manager belongs to * @name GuildTextThreadManager#channel - * @type {TextChannel|NewsChannel} + * @type {TextChannel|AnnouncementChannel} */ /** @@ -22,7 +22,7 @@ class GuildTextThreadManager extends ThreadManager { * If this is defined, then the `type` of thread gets inferred automatically and cannot be changed. * @property {ThreadChannelTypes} [type] The type of thread to create. * Defaults to {@link ChannelType.PublicThread} if created in a {@link TextChannel} - * When creating threads in a {@link NewsChannel}, this is ignored and is always + * When creating threads in a {@link AnnouncementChannel}, this is ignored and is always * {@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.PrivateThread} diff --git a/packages/discord.js/src/managers/ThreadManager.js b/packages/discord.js/src/managers/ThreadManager.js index ab32cc495..a8bf2a67e 100644 --- a/packages/discord.js/src/managers/ThreadManager.js +++ b/packages/discord.js/src/managers/ThreadManager.js @@ -20,7 +20,7 @@ class ThreadManager extends CachedManager { /** * The channel this Manager belongs to - * @type {TextChannel|NewsChannel|ForumChannel|MediaChannel} + * @type {TextChannel|AnnouncementChannel|ForumChannel|MediaChannel} */ this.channel = channel; } diff --git a/packages/discord.js/src/structures/NewsChannel.js b/packages/discord.js/src/structures/AnnouncementChannel.js similarity index 83% rename from packages/discord.js/src/structures/NewsChannel.js rename to packages/discord.js/src/structures/AnnouncementChannel.js index 3f5aff3ac..a23f8b26b 100644 --- a/packages/discord.js/src/structures/NewsChannel.js +++ b/packages/discord.js/src/structures/AnnouncementChannel.js @@ -5,15 +5,15 @@ const BaseGuildTextChannel = require('./BaseGuildTextChannel'); const { DiscordjsError, ErrorCodes } = require('../errors'); /** - * Represents a guild news channel on Discord. + * Represents a guild announcement channel on Discord. * @extends {BaseGuildTextChannel} */ -class NewsChannel extends BaseGuildTextChannel { +class AnnouncementChannel extends BaseGuildTextChannel { /** * Adds the target to this channel's followers. * @param {TextChannelResolvable} channel The channel where the webhook should be created * @param {string} [reason] Reason for creating the webhook - * @returns {Promise} + * @returns {Promise} * @example * if (channel.type === ChannelType.GuildAnnouncement) { * channel.addFollower('222197033908436994', 'Important announcements') @@ -29,4 +29,4 @@ class NewsChannel extends BaseGuildTextChannel { } } -module.exports = NewsChannel; +module.exports = AnnouncementChannel; diff --git a/packages/discord.js/src/structures/BaseGuildTextChannel.js b/packages/discord.js/src/structures/BaseGuildTextChannel.js index 9b8490ecc..c271565d7 100644 --- a/packages/discord.js/src/structures/BaseGuildTextChannel.js +++ b/packages/discord.js/src/structures/BaseGuildTextChannel.js @@ -101,7 +101,7 @@ class BaseGuildTextChannel extends GuildChannel { /** * Sets the type of this channel. - * Only conversion between {@link TextChannel} and {@link NewsChannel} is supported. + * Only conversion between {@link TextChannel} and {@link AnnouncementChannel} is supported. * @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 733b6094b..fa11307fc 100644 --- a/packages/discord.js/src/structures/Guild.js +++ b/packages/discord.js/src/structures/Guild.js @@ -514,7 +514,7 @@ class Guild extends AnonymousGuild { /** * Widget channel for this guild - * @type {?(TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel|MediaChannel)} + * @type {?(TextChannel|AnnouncementChannel|VoiceChannel|StageChannel|ForumChannel|MediaChannel)} * @readonly */ get widgetChannel() { @@ -687,7 +687,7 @@ class Guild extends AnonymousGuild { * Data for the Guild Widget Settings object * @typedef {Object} GuildWidgetSettings * @property {boolean} enabled Whether the widget is enabled - * @property {?(TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel|MediaChannel)} channel + * @property {?(TextChannel|AnnouncementChannel|VoiceChannel|StageChannel|ForumChannel|MediaChannel)} channel * The widget invite channel */ @@ -695,8 +695,8 @@ class Guild extends AnonymousGuild { * The Guild Widget Settings object * @typedef {Object} GuildWidgetSettingsData * @property {boolean} enabled Whether the widget is enabled - * @property {?(TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel|MediaChannel|Snowflake)} channel - * The widget invite channel + * @property {?(TextChannel|AnnouncementChannel|VoiceChannel|StageChannel|ForumChannel| + * MediaChannel|Snowflake)} channel The widget invite channel */ /** @@ -958,7 +958,7 @@ class Guild extends AnonymousGuild { * Welcome channel data * @typedef {Object} WelcomeChannelData * @property {string} description The description to show for this welcome channel - * @property {TextChannel|NewsChannel|ForumChannel|MediaChannel|Snowflake} channel + * @property {TextChannel|AnnouncementChannel|ForumChannel|MediaChannel|Snowflake} channel * The channel to link for this welcome channel * @property {EmojiIdentifierResolvable} [emoji] The emoji to display for this welcome channel */ @@ -974,9 +974,9 @@ class Guild extends AnonymousGuild { /** * Data that can be resolved to a GuildTextChannel object. This can be: * * A TextChannel - * * A NewsChannel + * * A AnnouncementChannel * * A Snowflake - * @typedef {TextChannel|NewsChannel|Snowflake} GuildTextChannelResolvable + * @typedef {TextChannel|AnnouncementChannel|Snowflake} GuildTextChannelResolvable */ /** diff --git a/packages/discord.js/src/structures/GuildChannel.js b/packages/discord.js/src/structures/GuildChannel.js index a25434a48..e0e9ee027 100644 --- a/packages/discord.js/src/structures/GuildChannel.js +++ b/packages/discord.js/src/structures/GuildChannel.js @@ -14,7 +14,7 @@ const { getSortableGroupTypes } = require('../util/Util'); * - {@link TextChannel} * - {@link VoiceChannel} * - {@link CategoryChannel} - * - {@link NewsChannel} + * - {@link AnnouncementChannel} * - {@link StageChannel} * - {@link ForumChannel} * - {@link MediaChannel} diff --git a/packages/discord.js/src/structures/ThreadChannel.js b/packages/discord.js/src/structures/ThreadChannel.js index a0d8c2b38..129fa3ae3 100644 --- a/packages/discord.js/src/structures/ThreadChannel.js +++ b/packages/discord.js/src/structures/ThreadChannel.js @@ -250,7 +250,7 @@ class ThreadChannel extends BaseChannel { /** * The parent channel of this thread - * @type {?(NewsChannel|TextChannel|ForumChannel|MediaChannel)} + * @type {?(AnnouncementChannel|TextChannel|ForumChannel|MediaChannel)} * @readonly */ get parent() { diff --git a/packages/discord.js/src/structures/Webhook.js b/packages/discord.js/src/structures/Webhook.js index e52ec1404..7151b17cd 100644 --- a/packages/discord.js/src/structures/Webhook.js +++ b/packages/discord.js/src/structures/Webhook.js @@ -116,7 +116,7 @@ class Webhook { if ('source_channel' in data) { /** * The source channel of the webhook - * @type {?(NewsChannel|APIChannel)} + * @type {?(AnnouncementChannel|APIChannel)} */ this.sourceChannel = this.client.channels?.resolve(data.source_channel?.id) ?? data.source_channel; } else { @@ -149,7 +149,7 @@ class Webhook { /** * The channel the webhook belongs to - * @type {?(TextChannel|VoiceChannel|StageChannel|NewsChannel|ForumChannel|MediaChannel)} + * @type {?(TextChannel|VoiceChannel|StageChannel|AnnouncementChannel|ForumChannel|MediaChannel)} * @readonly */ get channel() { diff --git a/packages/discord.js/src/structures/WelcomeChannel.js b/packages/discord.js/src/structures/WelcomeChannel.js index 3ca99a156..4b2c69ac7 100644 --- a/packages/discord.js/src/structures/WelcomeChannel.js +++ b/packages/discord.js/src/structures/WelcomeChannel.js @@ -42,7 +42,7 @@ class WelcomeChannel extends Base { /** * The channel of this welcome channel - * @type {?(TextChannel|NewsChannel|ForumChannel|MediaChannel)} + * @type {?(TextChannel|AnnouncementChannel|ForumChannel|MediaChannel)} */ get channel() { return this.client.channels.resolve(this.channelId); diff --git a/packages/discord.js/src/util/Channels.js b/packages/discord.js/src/util/Channels.js index 939185045..9c5310e5a 100644 --- a/packages/discord.js/src/util/Channels.js +++ b/packages/discord.js/src/util/Channels.js @@ -5,7 +5,7 @@ const { ChannelType } = require('discord-api-types/v10'); const getCategoryChannel = lazy(() => require('../structures/CategoryChannel')); const getDMChannel = lazy(() => require('../structures/DMChannel')); -const getNewsChannel = lazy(() => require('../structures/NewsChannel')); +const getAnnouncementChannel = lazy(() => require('../structures/AnnouncementChannel')); const getStageChannel = lazy(() => require('../structures/StageChannel')); const getTextChannel = lazy(() => require('../structures/TextChannel')); const getThreadChannel = lazy(() => require('../structures/ThreadChannel')); @@ -57,7 +57,7 @@ function createChannel(client, data, guild, { allowUnknownGuild } = {}) { break; } case ChannelType.GuildAnnouncement: { - channel = new (getNewsChannel())(guild, data, client); + channel = new (getAnnouncementChannel())(guild, data, client); break; } case ChannelType.GuildStageVoice: { diff --git a/packages/discord.js/src/util/Constants.js b/packages/discord.js/src/util/Constants.js index 0a2f48d0e..c4209cb3c 100644 --- a/packages/discord.js/src/util/Constants.js +++ b/packages/discord.js/src/util/Constants.js @@ -65,11 +65,11 @@ exports.NonSystemMessageTypes = [ /** * The guild channels that are text-based. * * TextChannel - * * NewsChannel + * * AnnouncementChannel * * ThreadChannel * * VoiceChannel * * StageChannel - * @typedef {TextChannel|NewsChannel|ThreadChannel|VoiceChannel|StageChannel} GuildTextBasedChannel + * @typedef {TextChannel|AnnouncementChannel|ThreadChannel|VoiceChannel|StageChannel} GuildTextBasedChannel */ /** diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index fa08c5f54..7867472f2 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -642,7 +642,7 @@ export class BaseGuildTextChannel extends GuildChannel { public defaultThreadRateLimitPerUser: number | null; public rateLimitPerUser: number | null; public nsfw: boolean; - public threads: GuildTextThreadManager; + public threads: GuildTextThreadManager; public topic: string | null; public createInvite(options?: InviteCreateOptions): Promise; public fetchInvites(cache?: boolean): Promise>; @@ -652,7 +652,7 @@ export class BaseGuildTextChannel extends GuildChannel { ): Promise; public setTopic(topic: string | null, reason?: string): Promise; public setType(type: ChannelType.GuildText, reason?: string): Promise; - public setType(type: ChannelType.GuildAnnouncement, reason?: string): Promise; + public setType(type: ChannelType.GuildAnnouncement, reason?: string): Promise; } // tslint:disable-next-line no-empty-interface @@ -886,7 +886,7 @@ export class Embed { } export interface MappedChannelCategoryTypes { - [ChannelType.GuildAnnouncement]: NewsChannel; + [ChannelType.GuildAnnouncement]: AnnouncementChannel; [ChannelType.GuildVoice]: VoiceChannel; [ChannelType.GuildText]: TextChannel; [ChannelType.GuildStageVoice]: StageChannel; @@ -1448,7 +1448,13 @@ export class Guild extends AnonymousGuild { public vanityURLUses: number | null; public get voiceAdapterCreator(): InternalDiscordGatewayAdapterCreator; public voiceStates: VoiceStateManager; - public get widgetChannel(): TextChannel | NewsChannel | VoiceBasedChannel | ForumChannel | MediaChannel | null; + public get widgetChannel(): + | TextChannel + | AnnouncementChannel + | VoiceBasedChannel + | ForumChannel + | MediaChannel + | null; public widgetChannelId: Snowflake | null; public widgetEnabled: boolean | null; public get maximumBitrate(): number; @@ -2517,13 +2523,13 @@ export class ModalSubmitInteraction extend public isFromMessage(): this is ModalMessageModalSubmitInteraction; } -export class NewsChannel extends BaseGuildTextChannel { - public threads: GuildTextThreadManager; +export class AnnouncementChannel extends BaseGuildTextChannel { + public threads: GuildTextThreadManager; public type: ChannelType.GuildAnnouncement; - public addFollower(channel: TextChannelResolvable, reason?: string): Promise; + public addFollower(channel: TextChannelResolvable, reason?: string): Promise; } -export type NewsChannelResolvable = NewsChannel | Snowflake; +export type AnnouncementChannelResolvable = AnnouncementChannel | Snowflake; export class OAuth2Guild extends BaseGuild { private constructor(client: Client, data: RawOAuth2GuildData); @@ -3296,7 +3302,7 @@ export class ThreadChannel extends BaseCha public members: ThreadMemberManager; public name: string; public ownerId: Snowflake | null; - public get parent(): If | null; + public get parent(): If | null; public parentId: Snowflake | null; public rateLimitPerUser: number | null; public type: ThreadChannelType; @@ -3355,7 +3361,7 @@ export class Typing extends Base { public get guild(): Guild | null; public get member(): GuildMember | null; public inGuild(): this is this & { - channel: TextChannel | NewsChannel | ThreadChannel; + channel: TextChannel | AnnouncementChannel | ThreadChannel; get guild(): Guild; }; } @@ -3600,7 +3606,7 @@ export class Webhook { public name: string; public owner: Type extends WebhookType.Incoming ? User | APIUser | null : User | APIUser; public sourceGuild: Type extends WebhookType.ChannelFollower ? Guild | APIPartialGuild : null; - public sourceChannel: Type extends WebhookType.ChannelFollower ? NewsChannel | APIPartialChannel : null; + public sourceChannel: Type extends WebhookType.ChannelFollower ? AnnouncementChannel | APIPartialChannel : null; public token: Type extends WebhookType.Incoming ? string : Type extends WebhookType.ChannelFollower @@ -3608,7 +3614,14 @@ export class Webhook { : string | null; public type: Type; public applicationId: Type extends WebhookType.Application ? Snowflake : null; - public get channel(): TextChannel | VoiceChannel | NewsChannel | StageChannel | ForumChannel | MediaChannel | null; + public get channel(): + | TextChannel + | VoiceChannel + | AnnouncementChannel + | StageChannel + | ForumChannel + | MediaChannel + | null; public isUserCreated(): this is Webhook & { owner: User | APIUser; }; @@ -3675,7 +3688,7 @@ export class WelcomeChannel extends Base { public channelId: Snowflake; public guild: Guild | InviteGuild; public description: string; - public get channel(): TextChannel | NewsChannel | ForumChannel | MediaChannel | null; + public get channel(): TextChannel | AnnouncementChannel | ForumChannel | MediaChannel | null; public get emoji(): GuildEmoji | Emoji; } @@ -4096,7 +4109,7 @@ export class GuildChannelManager extends CachedManager; @@ -4395,10 +4408,10 @@ export class ThreadManager extends CachedM ThreadChannelResolvable > { protected constructor( - channel: TextChannel | NewsChannel | ForumChannel | MediaChannel, + channel: TextChannel | AnnouncementChannel | ForumChannel | MediaChannel, iterable?: Iterable, ); - public channel: If; + public channel: If; public fetch( options: ThreadChannelResolvable, cacheOptions?: BaseFetchOptions, @@ -4555,7 +4568,7 @@ export type AllowedPartial = | GuildScheduledEvent | ThreadMember; -export type AllowedThreadTypeForNewsChannel = ChannelType.AnnouncementThread; +export type AllowedThreadTypeForAnnouncementChannel = ChannelType.AnnouncementThread; export type AllowedThreadTypeForTextChannel = ChannelType.PublicThread | ChannelType.PrivateThread; @@ -5035,7 +5048,7 @@ export interface ChannelPosition { position?: number; } -export type GuildTextChannelResolvable = TextChannel | NewsChannel | Snowflake; +export type GuildTextChannelResolvable = TextChannel | AnnouncementChannel | Snowflake; export type ChannelResolvable = Channel | Snowflake; export interface ChannelWebhookCreateOptions { @@ -5045,7 +5058,7 @@ export interface ChannelWebhookCreateOptions { } export interface WebhookCreateOptions extends ChannelWebhookCreateOptions { - channel: TextChannel | NewsChannel | VoiceChannel | StageChannel | ForumChannel | MediaChannel | Snowflake; + channel: TextChannel | AnnouncementChannel | VoiceChannel | StageChannel | ForumChannel | MediaChannel | Snowflake; } export interface GuildMembersChunk { @@ -5147,7 +5160,7 @@ export interface ClientEvents { typingStart: [typing: Typing]; userUpdate: [oldUser: User | PartialUser, newUser: User]; voiceStateUpdate: [oldState: VoiceState, newState: VoiceState]; - webhooksUpdate: [channel: TextChannel | NewsChannel | VoiceChannel | ForumChannel | MediaChannel]; + webhooksUpdate: [channel: TextChannel | AnnouncementChannel | VoiceChannel | ForumChannel | MediaChannel]; interactionCreate: [interaction: Interaction]; stageInstanceCreate: [stageInstance: StageInstance]; stageInstanceUpdate: [oldStageInstance: StageInstance | null, newStageInstance: StageInstance]; @@ -5818,7 +5831,7 @@ export interface GuildCreateOptions { export interface GuildWidgetSettings { enabled: boolean; - channel: TextChannel | NewsChannel | VoiceBasedChannel | ForumChannel | MediaChannel | null; + channel: TextChannel | AnnouncementChannel | VoiceBasedChannel | ForumChannel | MediaChannel | null; } export interface GuildEditOptions { @@ -5898,7 +5911,7 @@ export interface GuildPruneMembersOptions { export interface GuildWidgetSettingsData { enabled: boolean; - channel: TextChannel | NewsChannel | VoiceBasedChannel | ForumChannel | MediaChannel | Snowflake | null; + channel: TextChannel | AnnouncementChannel | VoiceBasedChannel | ForumChannel | MediaChannel | Snowflake | null; } export interface GuildSearchMembersOptions { @@ -6090,7 +6103,7 @@ export interface InviteGenerationOptions { export type GuildInvitableChannelResolvable = | TextChannel | VoiceChannel - | NewsChannel + | AnnouncementChannel | StageChannel | ForumChannel | MediaChannel @@ -6669,7 +6682,7 @@ export type Channel = | DMChannel | PartialDMChannel | PartialGroupDMChannel - | NewsChannel + | AnnouncementChannel | StageChannel | TextChannel | PublicThreadChannel @@ -6810,7 +6823,7 @@ export interface WidgetChannel { export interface WelcomeChannelData { description: string; - channel: TextChannel | NewsChannel | ForumChannel | MediaChannel | Snowflake; + channel: TextChannel | AnnouncementChannel | ForumChannel | MediaChannel | Snowflake; emoji?: EmojiIdentifierResolvable; } diff --git a/packages/discord.js/typings/index.test-d.ts b/packages/discord.js/typings/index.test-d.ts index 9fc56a981..390d69822 100644 --- a/packages/discord.js/typings/index.test-d.ts +++ b/packages/discord.js/typings/index.test-d.ts @@ -72,7 +72,7 @@ import { MessageComponentInteraction, MessageReaction, ModalBuilder, - NewsChannel, + AnnouncementChannel, Options, PartialTextBasedChannelFields, PartialUser, @@ -546,7 +546,7 @@ client.on('messageCreate', async message => { if (webhook.isChannelFollower()) { expectAssignable(webhook.sourceGuild); - expectAssignable(webhook.sourceChannel); + expectAssignable(webhook.sourceChannel); expectType>(webhook); } else if (webhook.isIncoming()) { expectType(webhook.token); @@ -554,7 +554,7 @@ client.on('messageCreate', async message => { } expectNotType(webhook.sourceGuild); - expectNotType(webhook.sourceChannel); + expectNotType(webhook.sourceChannel); expectNotType(webhook.token); channel.awaitMessageComponent({ @@ -1362,7 +1362,7 @@ declare const dmChannel: DMChannel; declare const threadChannel: ThreadChannel; declare const threadChannelFromForum: ThreadChannel; declare const threadChannelNotFromForum: ThreadChannel; -declare const newsChannel: NewsChannel; +declare const announcementChannel: AnnouncementChannel; declare const textChannel: TextChannel; declare const voiceChannel: VoiceChannel; declare const guild: Guild; @@ -1370,25 +1370,25 @@ declare const user: User; declare const guildMember: GuildMember; // Test thread channels' parent inference -expectType(threadChannel.parent); +expectType(threadChannel.parent); expectType(threadChannelFromForum.parent); -expectType(threadChannelNotFromForum.parent); +expectType(threadChannelNotFromForum.parent); // Test whether the structures implement send expectType['send']>(dmChannel.send); expectType['send']>(threadChannel.send); -expectType['send']>(newsChannel.send); +expectType['send']>(announcementChannel.send); expectType['send']>(textChannel.send); expectType['send']>(voiceChannel.send); expectAssignable(user); expectAssignable(guildMember); -expectType>(textChannel.setType(ChannelType.GuildAnnouncement)); -expectType>(newsChannel.setType(ChannelType.GuildText)); +expectType>(textChannel.setType(ChannelType.GuildAnnouncement)); +expectType>(announcementChannel.setType(ChannelType.GuildText)); expectType(dmChannel.lastMessage); expectType(threadChannel.lastMessage); -expectType(newsChannel.lastMessage); +expectType(announcementChannel.lastMessage); expectType(textChannel.lastMessage); expectType(voiceChannel.lastMessage); @@ -1569,7 +1569,7 @@ declare const categoryChannelChildManager: CategoryChannelChildManager; { expectType>(categoryChannelChildManager.create({ name: 'name', type: ChannelType.GuildVoice })); expectType>(categoryChannelChildManager.create({ name: 'name', type: ChannelType.GuildText })); - expectType>( + expectType>( categoryChannelChildManager.create({ name: 'name', type: ChannelType.GuildAnnouncement }), ); expectType>( @@ -1586,7 +1586,9 @@ 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.GuildAnnouncement })); + expectType>( + guildChannelManager.create({ name: 'name', type: ChannelType.GuildAnnouncement }), + ); expectType>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildStageVoice })); expectType>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildForum })); expectType>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildMedia })); @@ -1654,7 +1656,7 @@ expectType(guildForumThreadManager.channel); declare const guildTextThreadManager: GuildTextThreadManager< ChannelType.PublicThread | ChannelType.PrivateThread | ChannelType.AnnouncementThread >; -expectType(guildTextThreadManager.channel); +expectType(guildTextThreadManager.channel); declare const guildMemberManager: GuildMemberManager; { @@ -2203,9 +2205,9 @@ expectType< >(TextBasedChannelTypes); expectType(VoiceBasedChannel); expectType(GuildBasedChannel); -expectType( - NonThreadGuildBasedChannel, -); +expectType< + CategoryChannel | AnnouncementChannel | StageChannel | TextChannel | VoiceChannel | ForumChannel | MediaChannel +>(NonThreadGuildBasedChannel); expectType(GuildTextBasedChannel); const button = new ButtonBuilder({ @@ -2397,7 +2399,7 @@ expectType>(stageChannel.flags); expectType>(forumChannel.flags); expectType>(dmChannel.flags); expectType>(categoryChannel.flags); -expectType>(newsChannel.flags); +expectType>(announcementChannel.flags); expectType>(categoryChannel.flags); expectType>(threadChannel.flags);