From 62e03f2e9b740849047b31516bbbb14b94677385 Mon Sep 17 00:00:00 2001 From: Rodry <38259440+ImRodry@users.noreply.github.com> Date: Wed, 15 Mar 2023 03:35:04 +0000 Subject: [PATCH 1/3] feat: add GuildBasedTextChannelTypes --- packages/discord.js/src/util/Constants.js | 32 ++++++++++++++++------- packages/discord.js/typings/index.d.ts | 3 +++ 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/packages/discord.js/src/util/Constants.js b/packages/discord.js/src/util/Constants.js index f264e78d1170..2bfe29480e62 100644 --- a/packages/discord.js/src/util/Constants.js +++ b/packages/discord.js/src/util/Constants.js @@ -70,6 +70,27 @@ exports.NonSystemMessageTypes = [ * @typedef {TextChannel|NewsChannel|ThreadChannel|VoiceChannel|StageChannel} GuildTextBasedChannel */ +/** + * The types of channels that are text-based. The available types are: + * * {@link ChannelType.GuildText} + * * {@link ChannelType.GuildAnnouncement} + * * {@link ChannelType.AnnouncementThread} + * * {@link ChannelType.PublicThread} + * * {@link ChannelType.PrivateThread} + * * {@link ChannelType.GuildVoice} + * * {@link ChannelType.GuildStageVoice} + * @typedef {ChannelType[]} GuildTextBasedChannelTypes + */ +exports.GuildTextBasedChannelTypes = [ + ChannelType.GuildText, + ChannelType.GuildAnnouncement, + ChannelType.AnnouncementThread, + ChannelType.PublicThread, + ChannelType.PrivateThread, + ChannelType.GuildVoice, + ChannelType.GuildStageVoice, +]; + /** * The channels that are text-based. * * DMChannel @@ -96,16 +117,7 @@ exports.NonSystemMessageTypes = [ * * {@link ChannelType.GuildStageVoice} * @typedef {ChannelType[]} TextBasedChannelTypes */ -exports.TextBasedChannelTypes = [ - ChannelType.DM, - ChannelType.GuildText, - ChannelType.GuildAnnouncement, - ChannelType.AnnouncementThread, - ChannelType.PublicThread, - ChannelType.PrivateThread, - ChannelType.GuildVoice, - ChannelType.GuildStageVoice, -]; +exports.TextBasedChannelTypes = [...exports.TextBasedChannelTypes, ChannelType.DM]; /** * The types of channels that are threads. The available types are: diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 7059ba0f849f..ac9f4d6b5b66 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -3478,6 +3478,7 @@ export const Constants: { SweeperKeys: SweeperKey[]; NonSystemMessageTypes: NonSystemMessageType[]; TextBasedChannelTypes: TextBasedChannelTypes[]; + GuildTextBasedChannelTypes: GuildTextBasedChannelTypes[]; ThreadChannelTypes: ThreadChannelType[]; VoiceBasedChannelTypes: VoiceBasedChannelTypes[]; SelectMenuTypes: SelectMenuType[]; @@ -6206,6 +6207,8 @@ export type TextBasedChannel = Exclude< export type TextBasedChannelTypes = TextBasedChannel['type']; +export type GuildTextBasedChannelTypes = Exclude; + export type VoiceBasedChannel = Extract; export type GuildBasedChannel = Extract; From e00029b36fe4144dfc92ceb8b2477e8064c88f41 Mon Sep 17 00:00:00 2001 From: Rodry <38259440+ImRodry@users.noreply.github.com> Date: Wed, 15 Mar 2023 19:02:42 +0000 Subject: [PATCH 2/3] docs(GuildTextBasedChannels): distinguish from non other Co-authored-by: Jaw0r3k --- packages/discord.js/src/util/Constants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/discord.js/src/util/Constants.js b/packages/discord.js/src/util/Constants.js index 2bfe29480e62..322a1d256c56 100644 --- a/packages/discord.js/src/util/Constants.js +++ b/packages/discord.js/src/util/Constants.js @@ -71,7 +71,7 @@ exports.NonSystemMessageTypes = [ */ /** - * The types of channels that are text-based. The available types are: + * The types of guild channels that are text-based. The available types are: * * {@link ChannelType.GuildText} * * {@link ChannelType.GuildAnnouncement} * * {@link ChannelType.AnnouncementThread} From 7ed10f283f06e6e8bf150678dc211b12dd78c519 Mon Sep 17 00:00:00 2001 From: Rodry <38259440+ImRodry@users.noreply.github.com> Date: Sat, 18 Mar 2023 18:44:30 +0000 Subject: [PATCH 3/3] fix: spread correct array Co-authored-by: Vlad Frangu --- packages/discord.js/src/util/Constants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/discord.js/src/util/Constants.js b/packages/discord.js/src/util/Constants.js index 322a1d256c56..c2d3da95f403 100644 --- a/packages/discord.js/src/util/Constants.js +++ b/packages/discord.js/src/util/Constants.js @@ -117,7 +117,7 @@ exports.GuildTextBasedChannelTypes = [ * * {@link ChannelType.GuildStageVoice} * @typedef {ChannelType[]} TextBasedChannelTypes */ -exports.TextBasedChannelTypes = [...exports.TextBasedChannelTypes, ChannelType.DM]; +exports.TextBasedChannelTypes = [...exports.GuildTextBasedChannelTypes, ChannelType.DM]; /** * The types of channels that are threads. The available types are: