mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
refactor(NewsChannel)!: rename NewsChannel to AnnouncementChannel (#10532)
BREAKING CHANGE: The `NewsChannel` class was renamed to `AnnouncementChannel`, in line with the type name change
This commit is contained in:
@@ -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<Snowflake, ThreadChannel>} threads The threads that were synced
|
||||
* @param {Guild} guild The guild that the threads were synced in
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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}`,
|
||||
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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<Snowflake>} 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
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
|
||||
@@ -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 {
|
||||
* <warn>If this is defined, then the `type` of thread gets inferred automatically and cannot be changed.</warn>
|
||||
* @property {ThreadChannelTypes} [type] The type of thread to create.
|
||||
* Defaults to {@link ChannelType.PublicThread} if created in a {@link TextChannel}
|
||||
* <warn>When creating threads in a {@link NewsChannel}, this is ignored and is always
|
||||
* <warn>When creating threads in a {@link AnnouncementChannel}, this is ignored and is always
|
||||
* {@link ChannelType.AnnouncementThread}</warn>
|
||||
* @property {boolean} [invitable] Whether non-moderators can add other non-moderators to the thread
|
||||
* <info>Can only be set when type will be {@link ChannelType.PrivateThread}</info>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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<NewsChannel>}
|
||||
* @returns {Promise<AnnouncementChannel>}
|
||||
* @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;
|
||||
@@ -101,7 +101,7 @@ class BaseGuildTextChannel extends GuildChannel {
|
||||
|
||||
/**
|
||||
* Sets the type of this channel.
|
||||
* <info>Only conversion between {@link TextChannel} and {@link NewsChannel} is supported.</info>
|
||||
* <info>Only conversion between {@link TextChannel} and {@link AnnouncementChannel} is supported.</info>
|
||||
* @param {ChannelType.GuildText|ChannelType.GuildAnnouncement} type The new channel type
|
||||
* @param {string} [reason] Reason for changing the channel's type
|
||||
* @returns {Promise<GuildChannel>}
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
63
packages/discord.js/typings/index.d.ts
vendored
63
packages/discord.js/typings/index.d.ts
vendored
@@ -642,7 +642,7 @@ export class BaseGuildTextChannel extends GuildChannel {
|
||||
public defaultThreadRateLimitPerUser: number | null;
|
||||
public rateLimitPerUser: number | null;
|
||||
public nsfw: boolean;
|
||||
public threads: GuildTextThreadManager<AllowedThreadTypeForTextChannel | AllowedThreadTypeForNewsChannel>;
|
||||
public threads: GuildTextThreadManager<AllowedThreadTypeForTextChannel | AllowedThreadTypeForAnnouncementChannel>;
|
||||
public topic: string | null;
|
||||
public createInvite(options?: InviteCreateOptions): Promise<Invite>;
|
||||
public fetchInvites(cache?: boolean): Promise<Collection<string, Invite>>;
|
||||
@@ -652,7 +652,7 @@ export class BaseGuildTextChannel extends GuildChannel {
|
||||
): Promise<this>;
|
||||
public setTopic(topic: string | null, reason?: string): Promise<this>;
|
||||
public setType(type: ChannelType.GuildText, reason?: string): Promise<TextChannel>;
|
||||
public setType(type: ChannelType.GuildAnnouncement, reason?: string): Promise<NewsChannel>;
|
||||
public setType(type: ChannelType.GuildAnnouncement, reason?: string): Promise<AnnouncementChannel>;
|
||||
}
|
||||
|
||||
// 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<Cached extends CacheType = CacheType> extend
|
||||
public isFromMessage(): this is ModalMessageModalSubmitInteraction<Cached>;
|
||||
}
|
||||
|
||||
export class NewsChannel extends BaseGuildTextChannel {
|
||||
public threads: GuildTextThreadManager<AllowedThreadTypeForNewsChannel>;
|
||||
export class AnnouncementChannel extends BaseGuildTextChannel {
|
||||
public threads: GuildTextThreadManager<AllowedThreadTypeForAnnouncementChannel>;
|
||||
public type: ChannelType.GuildAnnouncement;
|
||||
public addFollower(channel: TextChannelResolvable, reason?: string): Promise<NewsChannel>;
|
||||
public addFollower(channel: TextChannelResolvable, reason?: string): Promise<AnnouncementChannel>;
|
||||
}
|
||||
|
||||
export type NewsChannelResolvable = NewsChannel | Snowflake;
|
||||
export type AnnouncementChannelResolvable = AnnouncementChannel | Snowflake;
|
||||
|
||||
export class OAuth2Guild extends BaseGuild {
|
||||
private constructor(client: Client<true>, data: RawOAuth2GuildData);
|
||||
@@ -3296,7 +3302,7 @@ export class ThreadChannel<ThreadOnly extends boolean = boolean> extends BaseCha
|
||||
public members: ThreadMemberManager;
|
||||
public name: string;
|
||||
public ownerId: Snowflake | null;
|
||||
public get parent(): If<ThreadOnly, ForumChannel | MediaChannel, TextChannel | NewsChannel> | null;
|
||||
public get parent(): If<ThreadOnly, ForumChannel | MediaChannel, TextChannel | AnnouncementChannel> | 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<Type extends WebhookType = WebhookType> {
|
||||
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<Type extends WebhookType = WebhookType> {
|
||||
: 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<WebhookType.Incoming> & {
|
||||
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<Snowflake, GuildBasedChan
|
||||
public guild: Guild;
|
||||
|
||||
public addFollower(
|
||||
channel: NewsChannelResolvable,
|
||||
channel: AnnouncementChannelResolvable,
|
||||
targetChannel: TextChannelResolvable,
|
||||
reason?: string,
|
||||
): Promise<Snowflake>;
|
||||
@@ -4395,10 +4408,10 @@ export class ThreadManager<ThreadOnly extends boolean = boolean> extends CachedM
|
||||
ThreadChannelResolvable
|
||||
> {
|
||||
protected constructor(
|
||||
channel: TextChannel | NewsChannel | ForumChannel | MediaChannel,
|
||||
channel: TextChannel | AnnouncementChannel | ForumChannel | MediaChannel,
|
||||
iterable?: Iterable<RawThreadChannelData>,
|
||||
);
|
||||
public channel: If<ThreadOnly, ForumChannel | MediaChannel, TextChannel | NewsChannel>;
|
||||
public channel: If<ThreadOnly, ForumChannel | MediaChannel, TextChannel | AnnouncementChannel>;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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<Guild | APIPartialGuild>(webhook.sourceGuild);
|
||||
expectAssignable<NewsChannel | APIPartialChannel>(webhook.sourceChannel);
|
||||
expectAssignable<AnnouncementChannel | APIPartialChannel>(webhook.sourceChannel);
|
||||
expectType<Webhook<WebhookType.ChannelFollower>>(webhook);
|
||||
} else if (webhook.isIncoming()) {
|
||||
expectType<string>(webhook.token);
|
||||
@@ -554,7 +554,7 @@ client.on('messageCreate', async message => {
|
||||
}
|
||||
|
||||
expectNotType<Guild | APIPartialGuild>(webhook.sourceGuild);
|
||||
expectNotType<NewsChannel | APIPartialChannel>(webhook.sourceChannel);
|
||||
expectNotType<AnnouncementChannel | APIPartialChannel>(webhook.sourceChannel);
|
||||
expectNotType<string>(webhook.token);
|
||||
|
||||
channel.awaitMessageComponent({
|
||||
@@ -1362,7 +1362,7 @@ declare const dmChannel: DMChannel;
|
||||
declare const threadChannel: ThreadChannel;
|
||||
declare const threadChannelFromForum: ThreadChannel<true>;
|
||||
declare const threadChannelNotFromForum: ThreadChannel<false>;
|
||||
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<TextChannel | NewsChannel | ForumChannel | MediaChannel | null>(threadChannel.parent);
|
||||
expectType<TextChannel | AnnouncementChannel | ForumChannel | MediaChannel | null>(threadChannel.parent);
|
||||
expectType<ForumChannel | MediaChannel | null>(threadChannelFromForum.parent);
|
||||
expectType<TextChannel | NewsChannel | null>(threadChannelNotFromForum.parent);
|
||||
expectType<TextChannel | AnnouncementChannel | null>(threadChannelNotFromForum.parent);
|
||||
|
||||
// Test whether the structures implement send
|
||||
expectType<TextBasedChannelFields<false>['send']>(dmChannel.send);
|
||||
expectType<TextBasedChannelFields<true>['send']>(threadChannel.send);
|
||||
expectType<TextBasedChannelFields<true>['send']>(newsChannel.send);
|
||||
expectType<TextBasedChannelFields<true>['send']>(announcementChannel.send);
|
||||
expectType<TextBasedChannelFields<true>['send']>(textChannel.send);
|
||||
expectType<TextBasedChannelFields<true>['send']>(voiceChannel.send);
|
||||
expectAssignable<PartialTextBasedChannelFields>(user);
|
||||
expectAssignable<PartialTextBasedChannelFields>(guildMember);
|
||||
|
||||
expectType<Promise<NewsChannel>>(textChannel.setType(ChannelType.GuildAnnouncement));
|
||||
expectType<Promise<TextChannel>>(newsChannel.setType(ChannelType.GuildText));
|
||||
expectType<Promise<AnnouncementChannel>>(textChannel.setType(ChannelType.GuildAnnouncement));
|
||||
expectType<Promise<TextChannel>>(announcementChannel.setType(ChannelType.GuildText));
|
||||
|
||||
expectType<Message | null>(dmChannel.lastMessage);
|
||||
expectType<Message | null>(threadChannel.lastMessage);
|
||||
expectType<Message | null>(newsChannel.lastMessage);
|
||||
expectType<Message | null>(announcementChannel.lastMessage);
|
||||
expectType<Message | null>(textChannel.lastMessage);
|
||||
expectType<Message | null>(voiceChannel.lastMessage);
|
||||
|
||||
@@ -1569,7 +1569,7 @@ declare const categoryChannelChildManager: CategoryChannelChildManager;
|
||||
{
|
||||
expectType<Promise<VoiceChannel>>(categoryChannelChildManager.create({ name: 'name', type: ChannelType.GuildVoice }));
|
||||
expectType<Promise<TextChannel>>(categoryChannelChildManager.create({ name: 'name', type: ChannelType.GuildText }));
|
||||
expectType<Promise<NewsChannel>>(
|
||||
expectType<Promise<AnnouncementChannel>>(
|
||||
categoryChannelChildManager.create({ name: 'name', type: ChannelType.GuildAnnouncement }),
|
||||
);
|
||||
expectType<Promise<StageChannel>>(
|
||||
@@ -1586,7 +1586,9 @@ declare const guildChannelManager: GuildChannelManager;
|
||||
expectType<Promise<VoiceChannel>>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildVoice }));
|
||||
expectType<Promise<CategoryChannel>>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildCategory }));
|
||||
expectType<Promise<TextChannel>>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildText }));
|
||||
expectType<Promise<NewsChannel>>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildAnnouncement }));
|
||||
expectType<Promise<AnnouncementChannel>>(
|
||||
guildChannelManager.create({ name: 'name', type: ChannelType.GuildAnnouncement }),
|
||||
);
|
||||
expectType<Promise<StageChannel>>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildStageVoice }));
|
||||
expectType<Promise<ForumChannel>>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildForum }));
|
||||
expectType<Promise<MediaChannel>>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildMedia }));
|
||||
@@ -1654,7 +1656,7 @@ expectType<ForumChannel | MediaChannel>(guildForumThreadManager.channel);
|
||||
declare const guildTextThreadManager: GuildTextThreadManager<
|
||||
ChannelType.PublicThread | ChannelType.PrivateThread | ChannelType.AnnouncementThread
|
||||
>;
|
||||
expectType<TextChannel | NewsChannel>(guildTextThreadManager.channel);
|
||||
expectType<TextChannel | AnnouncementChannel>(guildTextThreadManager.channel);
|
||||
|
||||
declare const guildMemberManager: GuildMemberManager;
|
||||
{
|
||||
@@ -2203,9 +2205,9 @@ expectType<
|
||||
>(TextBasedChannelTypes);
|
||||
expectType<StageChannel | VoiceChannel>(VoiceBasedChannel);
|
||||
expectType<GuildBasedChannel>(GuildBasedChannel);
|
||||
expectType<CategoryChannel | NewsChannel | StageChannel | TextChannel | VoiceChannel | ForumChannel | MediaChannel>(
|
||||
NonThreadGuildBasedChannel,
|
||||
);
|
||||
expectType<
|
||||
CategoryChannel | AnnouncementChannel | StageChannel | TextChannel | VoiceChannel | ForumChannel | MediaChannel
|
||||
>(NonThreadGuildBasedChannel);
|
||||
expectType<GuildTextBasedChannel>(GuildTextBasedChannel);
|
||||
|
||||
const button = new ButtonBuilder({
|
||||
@@ -2397,7 +2399,7 @@ expectType<Readonly<ChannelFlagsBitField>>(stageChannel.flags);
|
||||
expectType<Readonly<ChannelFlagsBitField>>(forumChannel.flags);
|
||||
expectType<Readonly<ChannelFlagsBitField>>(dmChannel.flags);
|
||||
expectType<Readonly<ChannelFlagsBitField>>(categoryChannel.flags);
|
||||
expectType<Readonly<ChannelFlagsBitField>>(newsChannel.flags);
|
||||
expectType<Readonly<ChannelFlagsBitField>>(announcementChannel.flags);
|
||||
expectType<Readonly<ChannelFlagsBitField>>(categoryChannel.flags);
|
||||
expectType<Readonly<ChannelFlagsBitField>>(threadChannel.flags);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user