Skip to content

Commit

Permalink
feat: add GuildBasedTextChannelTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
ImRodry committed Mar 15, 2023
1 parent 41077c9 commit 8526d2e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
29 changes: 20 additions & 9 deletions packages/discord.js/src/util/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,25 @@ 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}
* @typedef {ChannelType[]} GuildTextBasedChannelTypes
*/
exports.GuildTextBasedChannelTypes = [
ChannelType.GuildText,
ChannelType.GuildAnnouncement,
ChannelType.AnnouncementThread,
ChannelType.PublicThread,
ChannelType.PrivateThread,
ChannelType.GuildVoice,
];

/**
* The channels that are text-based.
* * DMChannel
Expand All @@ -95,15 +114,7 @@ exports.NonSystemMessageTypes = [
* * {@link ChannelType.GuildVoice}
* @typedef {ChannelType[]} TextBasedChannelTypes
*/
exports.TextBasedChannelTypes = [
ChannelType.DM,
ChannelType.GuildText,
ChannelType.GuildAnnouncement,
ChannelType.AnnouncementThread,
ChannelType.PublicThread,
ChannelType.PrivateThread,
ChannelType.GuildVoice,
];
exports.TextBasedChannelTypes = [...exports.TextBasedChannelTypes, ChannelType.DM];

/**
* The types of channels that are threads. The available types are:
Expand Down
3 changes: 3 additions & 0 deletions packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3478,6 +3478,7 @@ export const Constants: {
SweeperKeys: SweeperKey[];
NonSystemMessageTypes: NonSystemMessageType[];
TextBasedChannelTypes: TextBasedChannelTypes[];
GuildTextBasedChannelTypes: GuildTextBasedChannelTypes[];
ThreadChannelTypes: ThreadChannelType[];
VoiceBasedChannelTypes: VoiceBasedChannelTypes[];
SelectMenuTypes: SelectMenuType[];
Expand Down Expand Up @@ -6206,6 +6207,8 @@ export type TextBasedChannel = Exclude<

export type TextBasedChannelTypes = TextBasedChannel['type'];

export type GuildTextBasedChannelTypes = Exclude<TextBasedChannelTypes, ChannelType.DM>;

export type VoiceBasedChannel = Extract<Channel, { bitrate: number }>;

export type GuildBasedChannel = Extract<Channel, { guild: Guild }>;
Expand Down

0 comments on commit 8526d2e

Please sign in to comment.