mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 11:33: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
|
* @event Client#threadListSync
|
||||||
* @param {Collection<Snowflake, ThreadChannel>} threads The threads that were synced
|
* @param {Collection<Snowflake, ThreadChannel>} threads The threads that were synced
|
||||||
* @param {Guild} guild The guild that the threads were synced in
|
* @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.
|
* Emitted whenever a channel has its webhooks changed.
|
||||||
* @event Client#webhooksUpdate
|
* @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
|
* The channel that had a webhook update
|
||||||
*/
|
*/
|
||||||
client.emit(Events.WebhooksUpdate, channel);
|
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.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.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.MessageExistingThread]: 'The message already has a thread',
|
||||||
[DjsErrorCodes.ThreadInvitableType]: type => `Invitable cannot be edited on ${type}`,
|
[DjsErrorCodes.ThreadInvitableType]: type => `Invitable cannot be edited on ${type}`,
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ exports.MessagePayload = require('./structures/MessagePayload');
|
|||||||
exports.MessageReaction = require('./structures/MessageReaction');
|
exports.MessageReaction = require('./structures/MessageReaction');
|
||||||
exports.ModalSubmitInteraction = require('./structures/ModalSubmitInteraction');
|
exports.ModalSubmitInteraction = require('./structures/ModalSubmitInteraction');
|
||||||
exports.ModalSubmitFields = require('./structures/ModalSubmitFields');
|
exports.ModalSubmitFields = require('./structures/ModalSubmitFields');
|
||||||
exports.NewsChannel = require('./structures/NewsChannel');
|
exports.AnnouncementChannel = require('./structures/AnnouncementChannel.js');
|
||||||
exports.OAuth2Guild = require('./structures/OAuth2Guild');
|
exports.OAuth2Guild = require('./structures/OAuth2Guild');
|
||||||
exports.PartialGroupDMChannel = require('./structures/PartialGroupDMChannel');
|
exports.PartialGroupDMChannel = require('./structures/PartialGroupDMChannel');
|
||||||
exports.PermissionOverwrites = require('./structures/PermissionOverwrites');
|
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:
|
* Data that can be resolved to an Announcement Channel object. This can be:
|
||||||
* * A NewsChannel object
|
* * An Announcement Channel object
|
||||||
* * A Snowflake
|
* * A Snowflake
|
||||||
* @typedef {NewsChannel|Snowflake} NewsChannelResolvable
|
* @typedef {AnnouncementChannel|Snowflake} AnnouncementChannelResolvable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the target channel to a channel's followers.
|
* 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 {TextChannelResolvable} targetChannel The channel where published announcements will be posted at
|
||||||
* @param {string} [reason] Reason for creating the webhook
|
* @param {string} [reason] Reason for creating the webhook
|
||||||
* @returns {Promise<Snowflake>} Returns created target webhook id.
|
* @returns {Promise<Snowflake>} Returns created target webhook id.
|
||||||
@@ -115,7 +115,7 @@ class GuildChannelManager extends CachedManager {
|
|||||||
async addFollower(channel, targetChannel, reason) {
|
async addFollower(channel, targetChannel, reason) {
|
||||||
const channelId = this.resolveId(channel);
|
const channelId = this.resolveId(channel);
|
||||||
if (!channelId) {
|
if (!channelId) {
|
||||||
throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'channel', 'NewsChannelResolvable');
|
throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'channel', 'AnnouncementChannelResolvable');
|
||||||
}
|
}
|
||||||
const targetChannelId = this.resolveId(targetChannel);
|
const targetChannelId = this.resolveId(targetChannel);
|
||||||
if (!targetChannelId) {
|
if (!targetChannelId) {
|
||||||
@@ -208,7 +208,7 @@ class GuildChannelManager extends CachedManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {ChannelWebhookCreateOptions} WebhookCreateOptions
|
* @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
|
* The channel to create the webhook for
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -247,7 +247,7 @@ class GuildChannelManager extends CachedManager {
|
|||||||
* Options used to edit a guild channel.
|
* Options used to edit a guild channel.
|
||||||
* @typedef {Object} GuildChannelEditOptions
|
* @typedef {Object} GuildChannelEditOptions
|
||||||
* @property {string} [name] The name of the channel
|
* @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 {number} [position] The position of the channel
|
||||||
* @property {?string} [topic] The topic of the text channel
|
* @property {?string} [topic] The topic of the text channel
|
||||||
* @property {boolean} [nsfw] Whether the channel is NSFW
|
* @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:
|
* Data that can be resolved to a channel that an invite can be created on. This can be:
|
||||||
* * TextChannel
|
* * TextChannel
|
||||||
* * VoiceChannel
|
* * VoiceChannel
|
||||||
* * NewsChannel
|
* * AnnouncementChannel
|
||||||
* * StageChannel
|
* * StageChannel
|
||||||
* * ForumChannel
|
* * ForumChannel
|
||||||
* * MediaChannel
|
* * MediaChannel
|
||||||
* * Snowflake
|
* * Snowflake
|
||||||
* @typedef {TextChannel|VoiceChannel|NewsChannel|StageChannel|ForumChannel|MediaChannel|Snowflake}
|
* @typedef {TextChannel|VoiceChannel|AnnouncementChannel|StageChannel|ForumChannel|MediaChannel|Snowflake}
|
||||||
* GuildInvitableChannelResolvable
|
* GuildInvitableChannelResolvable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class GuildTextThreadManager extends ThreadManager {
|
|||||||
/**
|
/**
|
||||||
* The channel this Manager belongs to
|
* The channel this Manager belongs to
|
||||||
* @name GuildTextThreadManager#channel
|
* @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>
|
* <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.
|
* @property {ThreadChannelTypes} [type] The type of thread to create.
|
||||||
* Defaults to {@link ChannelType.PublicThread} if created in a {@link TextChannel}
|
* 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>
|
* {@link ChannelType.AnnouncementThread}</warn>
|
||||||
* @property {boolean} [invitable] Whether non-moderators can add other non-moderators to the thread
|
* @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>
|
* <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
|
* The channel this Manager belongs to
|
||||||
* @type {TextChannel|NewsChannel|ForumChannel|MediaChannel}
|
* @type {TextChannel|AnnouncementChannel|ForumChannel|MediaChannel}
|
||||||
*/
|
*/
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,15 +5,15 @@ const BaseGuildTextChannel = require('./BaseGuildTextChannel');
|
|||||||
const { DiscordjsError, ErrorCodes } = require('../errors');
|
const { DiscordjsError, ErrorCodes } = require('../errors');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a guild news channel on Discord.
|
* Represents a guild announcement channel on Discord.
|
||||||
* @extends {BaseGuildTextChannel}
|
* @extends {BaseGuildTextChannel}
|
||||||
*/
|
*/
|
||||||
class NewsChannel extends BaseGuildTextChannel {
|
class AnnouncementChannel extends BaseGuildTextChannel {
|
||||||
/**
|
/**
|
||||||
* Adds the target to this channel's followers.
|
* Adds the target to this channel's followers.
|
||||||
* @param {TextChannelResolvable} channel The channel where the webhook should be created
|
* @param {TextChannelResolvable} channel The channel where the webhook should be created
|
||||||
* @param {string} [reason] Reason for creating the webhook
|
* @param {string} [reason] Reason for creating the webhook
|
||||||
* @returns {Promise<NewsChannel>}
|
* @returns {Promise<AnnouncementChannel>}
|
||||||
* @example
|
* @example
|
||||||
* if (channel.type === ChannelType.GuildAnnouncement) {
|
* if (channel.type === ChannelType.GuildAnnouncement) {
|
||||||
* channel.addFollower('222197033908436994', 'Important announcements')
|
* 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.
|
* 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 {ChannelType.GuildText|ChannelType.GuildAnnouncement} type The new channel type
|
||||||
* @param {string} [reason] Reason for changing the channel's type
|
* @param {string} [reason] Reason for changing the channel's type
|
||||||
* @returns {Promise<GuildChannel>}
|
* @returns {Promise<GuildChannel>}
|
||||||
|
|||||||
@@ -514,7 +514,7 @@ class Guild extends AnonymousGuild {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Widget channel for this guild
|
* Widget channel for this guild
|
||||||
* @type {?(TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel|MediaChannel)}
|
* @type {?(TextChannel|AnnouncementChannel|VoiceChannel|StageChannel|ForumChannel|MediaChannel)}
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get widgetChannel() {
|
get widgetChannel() {
|
||||||
@@ -687,7 +687,7 @@ class Guild extends AnonymousGuild {
|
|||||||
* Data for the Guild Widget Settings object
|
* Data for the Guild Widget Settings object
|
||||||
* @typedef {Object} GuildWidgetSettings
|
* @typedef {Object} GuildWidgetSettings
|
||||||
* @property {boolean} enabled Whether the widget is enabled
|
* @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
|
* The widget invite channel
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -695,8 +695,8 @@ class Guild extends AnonymousGuild {
|
|||||||
* The Guild Widget Settings object
|
* The Guild Widget Settings object
|
||||||
* @typedef {Object} GuildWidgetSettingsData
|
* @typedef {Object} GuildWidgetSettingsData
|
||||||
* @property {boolean} enabled Whether the widget is enabled
|
* @property {boolean} enabled Whether the widget is enabled
|
||||||
* @property {?(TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel|MediaChannel|Snowflake)} channel
|
* @property {?(TextChannel|AnnouncementChannel|VoiceChannel|StageChannel|ForumChannel|
|
||||||
* The widget invite channel
|
* MediaChannel|Snowflake)} channel The widget invite channel
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -958,7 +958,7 @@ class Guild extends AnonymousGuild {
|
|||||||
* Welcome channel data
|
* Welcome channel data
|
||||||
* @typedef {Object} WelcomeChannelData
|
* @typedef {Object} WelcomeChannelData
|
||||||
* @property {string} description The description to show for this welcome channel
|
* @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
|
* The channel to link for this welcome channel
|
||||||
* @property {EmojiIdentifierResolvable} [emoji] The emoji to display 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:
|
* Data that can be resolved to a GuildTextChannel object. This can be:
|
||||||
* * A TextChannel
|
* * A TextChannel
|
||||||
* * A NewsChannel
|
* * A AnnouncementChannel
|
||||||
* * A Snowflake
|
* * A Snowflake
|
||||||
* @typedef {TextChannel|NewsChannel|Snowflake} GuildTextChannelResolvable
|
* @typedef {TextChannel|AnnouncementChannel|Snowflake} GuildTextChannelResolvable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const { getSortableGroupTypes } = require('../util/Util');
|
|||||||
* - {@link TextChannel}
|
* - {@link TextChannel}
|
||||||
* - {@link VoiceChannel}
|
* - {@link VoiceChannel}
|
||||||
* - {@link CategoryChannel}
|
* - {@link CategoryChannel}
|
||||||
* - {@link NewsChannel}
|
* - {@link AnnouncementChannel}
|
||||||
* - {@link StageChannel}
|
* - {@link StageChannel}
|
||||||
* - {@link ForumChannel}
|
* - {@link ForumChannel}
|
||||||
* - {@link MediaChannel}
|
* - {@link MediaChannel}
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ class ThreadChannel extends BaseChannel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The parent channel of this thread
|
* The parent channel of this thread
|
||||||
* @type {?(NewsChannel|TextChannel|ForumChannel|MediaChannel)}
|
* @type {?(AnnouncementChannel|TextChannel|ForumChannel|MediaChannel)}
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get parent() {
|
get parent() {
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ class Webhook {
|
|||||||
if ('source_channel' in data) {
|
if ('source_channel' in data) {
|
||||||
/**
|
/**
|
||||||
* The source channel of the webhook
|
* 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;
|
this.sourceChannel = this.client.channels?.resolve(data.source_channel?.id) ?? data.source_channel;
|
||||||
} else {
|
} else {
|
||||||
@@ -149,7 +149,7 @@ class Webhook {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The channel the webhook belongs to
|
* The channel the webhook belongs to
|
||||||
* @type {?(TextChannel|VoiceChannel|StageChannel|NewsChannel|ForumChannel|MediaChannel)}
|
* @type {?(TextChannel|VoiceChannel|StageChannel|AnnouncementChannel|ForumChannel|MediaChannel)}
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get channel() {
|
get channel() {
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class WelcomeChannel extends Base {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The channel of this welcome channel
|
* The channel of this welcome channel
|
||||||
* @type {?(TextChannel|NewsChannel|ForumChannel|MediaChannel)}
|
* @type {?(TextChannel|AnnouncementChannel|ForumChannel|MediaChannel)}
|
||||||
*/
|
*/
|
||||||
get channel() {
|
get channel() {
|
||||||
return this.client.channels.resolve(this.channelId);
|
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 getCategoryChannel = lazy(() => require('../structures/CategoryChannel'));
|
||||||
const getDMChannel = lazy(() => require('../structures/DMChannel'));
|
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 getStageChannel = lazy(() => require('../structures/StageChannel'));
|
||||||
const getTextChannel = lazy(() => require('../structures/TextChannel'));
|
const getTextChannel = lazy(() => require('../structures/TextChannel'));
|
||||||
const getThreadChannel = lazy(() => require('../structures/ThreadChannel'));
|
const getThreadChannel = lazy(() => require('../structures/ThreadChannel'));
|
||||||
@@ -57,7 +57,7 @@ function createChannel(client, data, guild, { allowUnknownGuild } = {}) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ChannelType.GuildAnnouncement: {
|
case ChannelType.GuildAnnouncement: {
|
||||||
channel = new (getNewsChannel())(guild, data, client);
|
channel = new (getAnnouncementChannel())(guild, data, client);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ChannelType.GuildStageVoice: {
|
case ChannelType.GuildStageVoice: {
|
||||||
|
|||||||
@@ -65,11 +65,11 @@ exports.NonSystemMessageTypes = [
|
|||||||
/**
|
/**
|
||||||
* The guild channels that are text-based.
|
* The guild channels that are text-based.
|
||||||
* * TextChannel
|
* * TextChannel
|
||||||
* * NewsChannel
|
* * AnnouncementChannel
|
||||||
* * ThreadChannel
|
* * ThreadChannel
|
||||||
* * VoiceChannel
|
* * VoiceChannel
|
||||||
* * StageChannel
|
* * 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 defaultThreadRateLimitPerUser: number | null;
|
||||||
public rateLimitPerUser: number | null;
|
public rateLimitPerUser: number | null;
|
||||||
public nsfw: boolean;
|
public nsfw: boolean;
|
||||||
public threads: GuildTextThreadManager<AllowedThreadTypeForTextChannel | AllowedThreadTypeForNewsChannel>;
|
public threads: GuildTextThreadManager<AllowedThreadTypeForTextChannel | AllowedThreadTypeForAnnouncementChannel>;
|
||||||
public topic: string | null;
|
public topic: string | null;
|
||||||
public createInvite(options?: InviteCreateOptions): Promise<Invite>;
|
public createInvite(options?: InviteCreateOptions): Promise<Invite>;
|
||||||
public fetchInvites(cache?: boolean): Promise<Collection<string, Invite>>;
|
public fetchInvites(cache?: boolean): Promise<Collection<string, Invite>>;
|
||||||
@@ -652,7 +652,7 @@ export class BaseGuildTextChannel extends GuildChannel {
|
|||||||
): Promise<this>;
|
): Promise<this>;
|
||||||
public setTopic(topic: string | null, reason?: string): Promise<this>;
|
public setTopic(topic: string | null, reason?: string): Promise<this>;
|
||||||
public setType(type: ChannelType.GuildText, reason?: string): Promise<TextChannel>;
|
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
|
// tslint:disable-next-line no-empty-interface
|
||||||
@@ -886,7 +886,7 @@ export class Embed {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface MappedChannelCategoryTypes {
|
export interface MappedChannelCategoryTypes {
|
||||||
[ChannelType.GuildAnnouncement]: NewsChannel;
|
[ChannelType.GuildAnnouncement]: AnnouncementChannel;
|
||||||
[ChannelType.GuildVoice]: VoiceChannel;
|
[ChannelType.GuildVoice]: VoiceChannel;
|
||||||
[ChannelType.GuildText]: TextChannel;
|
[ChannelType.GuildText]: TextChannel;
|
||||||
[ChannelType.GuildStageVoice]: StageChannel;
|
[ChannelType.GuildStageVoice]: StageChannel;
|
||||||
@@ -1448,7 +1448,13 @@ export class Guild extends AnonymousGuild {
|
|||||||
public vanityURLUses: number | null;
|
public vanityURLUses: number | null;
|
||||||
public get voiceAdapterCreator(): InternalDiscordGatewayAdapterCreator;
|
public get voiceAdapterCreator(): InternalDiscordGatewayAdapterCreator;
|
||||||
public voiceStates: VoiceStateManager;
|
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 widgetChannelId: Snowflake | null;
|
||||||
public widgetEnabled: boolean | null;
|
public widgetEnabled: boolean | null;
|
||||||
public get maximumBitrate(): number;
|
public get maximumBitrate(): number;
|
||||||
@@ -2517,13 +2523,13 @@ export class ModalSubmitInteraction<Cached extends CacheType = CacheType> extend
|
|||||||
public isFromMessage(): this is ModalMessageModalSubmitInteraction<Cached>;
|
public isFromMessage(): this is ModalMessageModalSubmitInteraction<Cached>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class NewsChannel extends BaseGuildTextChannel {
|
export class AnnouncementChannel extends BaseGuildTextChannel {
|
||||||
public threads: GuildTextThreadManager<AllowedThreadTypeForNewsChannel>;
|
public threads: GuildTextThreadManager<AllowedThreadTypeForAnnouncementChannel>;
|
||||||
public type: ChannelType.GuildAnnouncement;
|
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 {
|
export class OAuth2Guild extends BaseGuild {
|
||||||
private constructor(client: Client<true>, data: RawOAuth2GuildData);
|
private constructor(client: Client<true>, data: RawOAuth2GuildData);
|
||||||
@@ -3296,7 +3302,7 @@ export class ThreadChannel<ThreadOnly extends boolean = boolean> extends BaseCha
|
|||||||
public members: ThreadMemberManager;
|
public members: ThreadMemberManager;
|
||||||
public name: string;
|
public name: string;
|
||||||
public ownerId: Snowflake | null;
|
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 parentId: Snowflake | null;
|
||||||
public rateLimitPerUser: number | null;
|
public rateLimitPerUser: number | null;
|
||||||
public type: ThreadChannelType;
|
public type: ThreadChannelType;
|
||||||
@@ -3355,7 +3361,7 @@ export class Typing extends Base {
|
|||||||
public get guild(): Guild | null;
|
public get guild(): Guild | null;
|
||||||
public get member(): GuildMember | null;
|
public get member(): GuildMember | null;
|
||||||
public inGuild(): this is this & {
|
public inGuild(): this is this & {
|
||||||
channel: TextChannel | NewsChannel | ThreadChannel;
|
channel: TextChannel | AnnouncementChannel | ThreadChannel;
|
||||||
get guild(): Guild;
|
get guild(): Guild;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -3600,7 +3606,7 @@ export class Webhook<Type extends WebhookType = WebhookType> {
|
|||||||
public name: string;
|
public name: string;
|
||||||
public owner: Type extends WebhookType.Incoming ? User | APIUser | null : User | APIUser;
|
public owner: Type extends WebhookType.Incoming ? User | APIUser | null : User | APIUser;
|
||||||
public sourceGuild: Type extends WebhookType.ChannelFollower ? Guild | APIPartialGuild : null;
|
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
|
public token: Type extends WebhookType.Incoming
|
||||||
? string
|
? string
|
||||||
: Type extends WebhookType.ChannelFollower
|
: Type extends WebhookType.ChannelFollower
|
||||||
@@ -3608,7 +3614,14 @@ export class Webhook<Type extends WebhookType = WebhookType> {
|
|||||||
: string | null;
|
: string | null;
|
||||||
public type: Type;
|
public type: Type;
|
||||||
public applicationId: Type extends WebhookType.Application ? Snowflake : null;
|
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> & {
|
public isUserCreated(): this is Webhook<WebhookType.Incoming> & {
|
||||||
owner: User | APIUser;
|
owner: User | APIUser;
|
||||||
};
|
};
|
||||||
@@ -3675,7 +3688,7 @@ export class WelcomeChannel extends Base {
|
|||||||
public channelId: Snowflake;
|
public channelId: Snowflake;
|
||||||
public guild: Guild | InviteGuild;
|
public guild: Guild | InviteGuild;
|
||||||
public description: string;
|
public description: string;
|
||||||
public get channel(): TextChannel | NewsChannel | ForumChannel | MediaChannel | null;
|
public get channel(): TextChannel | AnnouncementChannel | ForumChannel | MediaChannel | null;
|
||||||
public get emoji(): GuildEmoji | Emoji;
|
public get emoji(): GuildEmoji | Emoji;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4096,7 +4109,7 @@ export class GuildChannelManager extends CachedManager<Snowflake, GuildBasedChan
|
|||||||
public guild: Guild;
|
public guild: Guild;
|
||||||
|
|
||||||
public addFollower(
|
public addFollower(
|
||||||
channel: NewsChannelResolvable,
|
channel: AnnouncementChannelResolvable,
|
||||||
targetChannel: TextChannelResolvable,
|
targetChannel: TextChannelResolvable,
|
||||||
reason?: string,
|
reason?: string,
|
||||||
): Promise<Snowflake>;
|
): Promise<Snowflake>;
|
||||||
@@ -4395,10 +4408,10 @@ export class ThreadManager<ThreadOnly extends boolean = boolean> extends CachedM
|
|||||||
ThreadChannelResolvable
|
ThreadChannelResolvable
|
||||||
> {
|
> {
|
||||||
protected constructor(
|
protected constructor(
|
||||||
channel: TextChannel | NewsChannel | ForumChannel | MediaChannel,
|
channel: TextChannel | AnnouncementChannel | ForumChannel | MediaChannel,
|
||||||
iterable?: Iterable<RawThreadChannelData>,
|
iterable?: Iterable<RawThreadChannelData>,
|
||||||
);
|
);
|
||||||
public channel: If<ThreadOnly, ForumChannel | MediaChannel, TextChannel | NewsChannel>;
|
public channel: If<ThreadOnly, ForumChannel | MediaChannel, TextChannel | AnnouncementChannel>;
|
||||||
public fetch(
|
public fetch(
|
||||||
options: ThreadChannelResolvable,
|
options: ThreadChannelResolvable,
|
||||||
cacheOptions?: BaseFetchOptions,
|
cacheOptions?: BaseFetchOptions,
|
||||||
@@ -4555,7 +4568,7 @@ export type AllowedPartial =
|
|||||||
| GuildScheduledEvent
|
| GuildScheduledEvent
|
||||||
| ThreadMember;
|
| ThreadMember;
|
||||||
|
|
||||||
export type AllowedThreadTypeForNewsChannel = ChannelType.AnnouncementThread;
|
export type AllowedThreadTypeForAnnouncementChannel = ChannelType.AnnouncementThread;
|
||||||
|
|
||||||
export type AllowedThreadTypeForTextChannel = ChannelType.PublicThread | ChannelType.PrivateThread;
|
export type AllowedThreadTypeForTextChannel = ChannelType.PublicThread | ChannelType.PrivateThread;
|
||||||
|
|
||||||
@@ -5035,7 +5048,7 @@ export interface ChannelPosition {
|
|||||||
position?: number;
|
position?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type GuildTextChannelResolvable = TextChannel | NewsChannel | Snowflake;
|
export type GuildTextChannelResolvable = TextChannel | AnnouncementChannel | Snowflake;
|
||||||
export type ChannelResolvable = Channel | Snowflake;
|
export type ChannelResolvable = Channel | Snowflake;
|
||||||
|
|
||||||
export interface ChannelWebhookCreateOptions {
|
export interface ChannelWebhookCreateOptions {
|
||||||
@@ -5045,7 +5058,7 @@ export interface ChannelWebhookCreateOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface WebhookCreateOptions extends 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 {
|
export interface GuildMembersChunk {
|
||||||
@@ -5147,7 +5160,7 @@ export interface ClientEvents {
|
|||||||
typingStart: [typing: Typing];
|
typingStart: [typing: Typing];
|
||||||
userUpdate: [oldUser: User | PartialUser, newUser: User];
|
userUpdate: [oldUser: User | PartialUser, newUser: User];
|
||||||
voiceStateUpdate: [oldState: VoiceState, newState: VoiceState];
|
voiceStateUpdate: [oldState: VoiceState, newState: VoiceState];
|
||||||
webhooksUpdate: [channel: TextChannel | NewsChannel | VoiceChannel | ForumChannel | MediaChannel];
|
webhooksUpdate: [channel: TextChannel | AnnouncementChannel | VoiceChannel | ForumChannel | MediaChannel];
|
||||||
interactionCreate: [interaction: Interaction];
|
interactionCreate: [interaction: Interaction];
|
||||||
stageInstanceCreate: [stageInstance: StageInstance];
|
stageInstanceCreate: [stageInstance: StageInstance];
|
||||||
stageInstanceUpdate: [oldStageInstance: StageInstance | null, newStageInstance: StageInstance];
|
stageInstanceUpdate: [oldStageInstance: StageInstance | null, newStageInstance: StageInstance];
|
||||||
@@ -5818,7 +5831,7 @@ export interface GuildCreateOptions {
|
|||||||
|
|
||||||
export interface GuildWidgetSettings {
|
export interface GuildWidgetSettings {
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
channel: TextChannel | NewsChannel | VoiceBasedChannel | ForumChannel | MediaChannel | null;
|
channel: TextChannel | AnnouncementChannel | VoiceBasedChannel | ForumChannel | MediaChannel | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GuildEditOptions {
|
export interface GuildEditOptions {
|
||||||
@@ -5898,7 +5911,7 @@ export interface GuildPruneMembersOptions {
|
|||||||
|
|
||||||
export interface GuildWidgetSettingsData {
|
export interface GuildWidgetSettingsData {
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
channel: TextChannel | NewsChannel | VoiceBasedChannel | ForumChannel | MediaChannel | Snowflake | null;
|
channel: TextChannel | AnnouncementChannel | VoiceBasedChannel | ForumChannel | MediaChannel | Snowflake | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GuildSearchMembersOptions {
|
export interface GuildSearchMembersOptions {
|
||||||
@@ -6090,7 +6103,7 @@ export interface InviteGenerationOptions {
|
|||||||
export type GuildInvitableChannelResolvable =
|
export type GuildInvitableChannelResolvable =
|
||||||
| TextChannel
|
| TextChannel
|
||||||
| VoiceChannel
|
| VoiceChannel
|
||||||
| NewsChannel
|
| AnnouncementChannel
|
||||||
| StageChannel
|
| StageChannel
|
||||||
| ForumChannel
|
| ForumChannel
|
||||||
| MediaChannel
|
| MediaChannel
|
||||||
@@ -6669,7 +6682,7 @@ export type Channel =
|
|||||||
| DMChannel
|
| DMChannel
|
||||||
| PartialDMChannel
|
| PartialDMChannel
|
||||||
| PartialGroupDMChannel
|
| PartialGroupDMChannel
|
||||||
| NewsChannel
|
| AnnouncementChannel
|
||||||
| StageChannel
|
| StageChannel
|
||||||
| TextChannel
|
| TextChannel
|
||||||
| PublicThreadChannel
|
| PublicThreadChannel
|
||||||
@@ -6810,7 +6823,7 @@ export interface WidgetChannel {
|
|||||||
|
|
||||||
export interface WelcomeChannelData {
|
export interface WelcomeChannelData {
|
||||||
description: string;
|
description: string;
|
||||||
channel: TextChannel | NewsChannel | ForumChannel | MediaChannel | Snowflake;
|
channel: TextChannel | AnnouncementChannel | ForumChannel | MediaChannel | Snowflake;
|
||||||
emoji?: EmojiIdentifierResolvable;
|
emoji?: EmojiIdentifierResolvable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ import {
|
|||||||
MessageComponentInteraction,
|
MessageComponentInteraction,
|
||||||
MessageReaction,
|
MessageReaction,
|
||||||
ModalBuilder,
|
ModalBuilder,
|
||||||
NewsChannel,
|
AnnouncementChannel,
|
||||||
Options,
|
Options,
|
||||||
PartialTextBasedChannelFields,
|
PartialTextBasedChannelFields,
|
||||||
PartialUser,
|
PartialUser,
|
||||||
@@ -546,7 +546,7 @@ client.on('messageCreate', async message => {
|
|||||||
|
|
||||||
if (webhook.isChannelFollower()) {
|
if (webhook.isChannelFollower()) {
|
||||||
expectAssignable<Guild | APIPartialGuild>(webhook.sourceGuild);
|
expectAssignable<Guild | APIPartialGuild>(webhook.sourceGuild);
|
||||||
expectAssignable<NewsChannel | APIPartialChannel>(webhook.sourceChannel);
|
expectAssignable<AnnouncementChannel | APIPartialChannel>(webhook.sourceChannel);
|
||||||
expectType<Webhook<WebhookType.ChannelFollower>>(webhook);
|
expectType<Webhook<WebhookType.ChannelFollower>>(webhook);
|
||||||
} else if (webhook.isIncoming()) {
|
} else if (webhook.isIncoming()) {
|
||||||
expectType<string>(webhook.token);
|
expectType<string>(webhook.token);
|
||||||
@@ -554,7 +554,7 @@ client.on('messageCreate', async message => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
expectNotType<Guild | APIPartialGuild>(webhook.sourceGuild);
|
expectNotType<Guild | APIPartialGuild>(webhook.sourceGuild);
|
||||||
expectNotType<NewsChannel | APIPartialChannel>(webhook.sourceChannel);
|
expectNotType<AnnouncementChannel | APIPartialChannel>(webhook.sourceChannel);
|
||||||
expectNotType<string>(webhook.token);
|
expectNotType<string>(webhook.token);
|
||||||
|
|
||||||
channel.awaitMessageComponent({
|
channel.awaitMessageComponent({
|
||||||
@@ -1362,7 +1362,7 @@ declare const dmChannel: DMChannel;
|
|||||||
declare const threadChannel: ThreadChannel;
|
declare const threadChannel: ThreadChannel;
|
||||||
declare const threadChannelFromForum: ThreadChannel<true>;
|
declare const threadChannelFromForum: ThreadChannel<true>;
|
||||||
declare const threadChannelNotFromForum: ThreadChannel<false>;
|
declare const threadChannelNotFromForum: ThreadChannel<false>;
|
||||||
declare const newsChannel: NewsChannel;
|
declare const announcementChannel: AnnouncementChannel;
|
||||||
declare const textChannel: TextChannel;
|
declare const textChannel: TextChannel;
|
||||||
declare const voiceChannel: VoiceChannel;
|
declare const voiceChannel: VoiceChannel;
|
||||||
declare const guild: Guild;
|
declare const guild: Guild;
|
||||||
@@ -1370,25 +1370,25 @@ declare const user: User;
|
|||||||
declare const guildMember: GuildMember;
|
declare const guildMember: GuildMember;
|
||||||
|
|
||||||
// Test thread channels' parent inference
|
// 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<ForumChannel | MediaChannel | null>(threadChannelFromForum.parent);
|
||||||
expectType<TextChannel | NewsChannel | null>(threadChannelNotFromForum.parent);
|
expectType<TextChannel | AnnouncementChannel | null>(threadChannelNotFromForum.parent);
|
||||||
|
|
||||||
// Test whether the structures implement send
|
// Test whether the structures implement send
|
||||||
expectType<TextBasedChannelFields<false>['send']>(dmChannel.send);
|
expectType<TextBasedChannelFields<false>['send']>(dmChannel.send);
|
||||||
expectType<TextBasedChannelFields<true>['send']>(threadChannel.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']>(textChannel.send);
|
||||||
expectType<TextBasedChannelFields<true>['send']>(voiceChannel.send);
|
expectType<TextBasedChannelFields<true>['send']>(voiceChannel.send);
|
||||||
expectAssignable<PartialTextBasedChannelFields>(user);
|
expectAssignable<PartialTextBasedChannelFields>(user);
|
||||||
expectAssignable<PartialTextBasedChannelFields>(guildMember);
|
expectAssignable<PartialTextBasedChannelFields>(guildMember);
|
||||||
|
|
||||||
expectType<Promise<NewsChannel>>(textChannel.setType(ChannelType.GuildAnnouncement));
|
expectType<Promise<AnnouncementChannel>>(textChannel.setType(ChannelType.GuildAnnouncement));
|
||||||
expectType<Promise<TextChannel>>(newsChannel.setType(ChannelType.GuildText));
|
expectType<Promise<TextChannel>>(announcementChannel.setType(ChannelType.GuildText));
|
||||||
|
|
||||||
expectType<Message | null>(dmChannel.lastMessage);
|
expectType<Message | null>(dmChannel.lastMessage);
|
||||||
expectType<Message | null>(threadChannel.lastMessage);
|
expectType<Message | null>(threadChannel.lastMessage);
|
||||||
expectType<Message | null>(newsChannel.lastMessage);
|
expectType<Message | null>(announcementChannel.lastMessage);
|
||||||
expectType<Message | null>(textChannel.lastMessage);
|
expectType<Message | null>(textChannel.lastMessage);
|
||||||
expectType<Message | null>(voiceChannel.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<VoiceChannel>>(categoryChannelChildManager.create({ name: 'name', type: ChannelType.GuildVoice }));
|
||||||
expectType<Promise<TextChannel>>(categoryChannelChildManager.create({ name: 'name', type: ChannelType.GuildText }));
|
expectType<Promise<TextChannel>>(categoryChannelChildManager.create({ name: 'name', type: ChannelType.GuildText }));
|
||||||
expectType<Promise<NewsChannel>>(
|
expectType<Promise<AnnouncementChannel>>(
|
||||||
categoryChannelChildManager.create({ name: 'name', type: ChannelType.GuildAnnouncement }),
|
categoryChannelChildManager.create({ name: 'name', type: ChannelType.GuildAnnouncement }),
|
||||||
);
|
);
|
||||||
expectType<Promise<StageChannel>>(
|
expectType<Promise<StageChannel>>(
|
||||||
@@ -1586,7 +1586,9 @@ declare const guildChannelManager: GuildChannelManager;
|
|||||||
expectType<Promise<VoiceChannel>>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildVoice }));
|
expectType<Promise<VoiceChannel>>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildVoice }));
|
||||||
expectType<Promise<CategoryChannel>>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildCategory }));
|
expectType<Promise<CategoryChannel>>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildCategory }));
|
||||||
expectType<Promise<TextChannel>>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildText }));
|
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<StageChannel>>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildStageVoice }));
|
||||||
expectType<Promise<ForumChannel>>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildForum }));
|
expectType<Promise<ForumChannel>>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildForum }));
|
||||||
expectType<Promise<MediaChannel>>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildMedia }));
|
expectType<Promise<MediaChannel>>(guildChannelManager.create({ name: 'name', type: ChannelType.GuildMedia }));
|
||||||
@@ -1654,7 +1656,7 @@ expectType<ForumChannel | MediaChannel>(guildForumThreadManager.channel);
|
|||||||
declare const guildTextThreadManager: GuildTextThreadManager<
|
declare const guildTextThreadManager: GuildTextThreadManager<
|
||||||
ChannelType.PublicThread | ChannelType.PrivateThread | ChannelType.AnnouncementThread
|
ChannelType.PublicThread | ChannelType.PrivateThread | ChannelType.AnnouncementThread
|
||||||
>;
|
>;
|
||||||
expectType<TextChannel | NewsChannel>(guildTextThreadManager.channel);
|
expectType<TextChannel | AnnouncementChannel>(guildTextThreadManager.channel);
|
||||||
|
|
||||||
declare const guildMemberManager: GuildMemberManager;
|
declare const guildMemberManager: GuildMemberManager;
|
||||||
{
|
{
|
||||||
@@ -2203,9 +2205,9 @@ expectType<
|
|||||||
>(TextBasedChannelTypes);
|
>(TextBasedChannelTypes);
|
||||||
expectType<StageChannel | VoiceChannel>(VoiceBasedChannel);
|
expectType<StageChannel | VoiceChannel>(VoiceBasedChannel);
|
||||||
expectType<GuildBasedChannel>(GuildBasedChannel);
|
expectType<GuildBasedChannel>(GuildBasedChannel);
|
||||||
expectType<CategoryChannel | NewsChannel | StageChannel | TextChannel | VoiceChannel | ForumChannel | MediaChannel>(
|
expectType<
|
||||||
NonThreadGuildBasedChannel,
|
CategoryChannel | AnnouncementChannel | StageChannel | TextChannel | VoiceChannel | ForumChannel | MediaChannel
|
||||||
);
|
>(NonThreadGuildBasedChannel);
|
||||||
expectType<GuildTextBasedChannel>(GuildTextBasedChannel);
|
expectType<GuildTextBasedChannel>(GuildTextBasedChannel);
|
||||||
|
|
||||||
const button = new ButtonBuilder({
|
const button = new ButtonBuilder({
|
||||||
@@ -2397,7 +2399,7 @@ expectType<Readonly<ChannelFlagsBitField>>(stageChannel.flags);
|
|||||||
expectType<Readonly<ChannelFlagsBitField>>(forumChannel.flags);
|
expectType<Readonly<ChannelFlagsBitField>>(forumChannel.flags);
|
||||||
expectType<Readonly<ChannelFlagsBitField>>(dmChannel.flags);
|
expectType<Readonly<ChannelFlagsBitField>>(dmChannel.flags);
|
||||||
expectType<Readonly<ChannelFlagsBitField>>(categoryChannel.flags);
|
expectType<Readonly<ChannelFlagsBitField>>(categoryChannel.flags);
|
||||||
expectType<Readonly<ChannelFlagsBitField>>(newsChannel.flags);
|
expectType<Readonly<ChannelFlagsBitField>>(announcementChannel.flags);
|
||||||
expectType<Readonly<ChannelFlagsBitField>>(categoryChannel.flags);
|
expectType<Readonly<ChannelFlagsBitField>>(categoryChannel.flags);
|
||||||
expectType<Readonly<ChannelFlagsBitField>>(threadChannel.flags);
|
expectType<Readonly<ChannelFlagsBitField>>(threadChannel.flags);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user