Skip to content

Commit

Permalink
refactor(ChannelType): rename news & thread types (#564)
Browse files Browse the repository at this point in the history
Warning: The renames are not considered breaking due to the fact the value is still the same. That said, the following renames were done:
- `GuildNews` -> `GuildAnnouncement`
- `GuildPublicThread`, `GuildPrivateThread` and `GuildNewsThread` lost the Guild prefix
- `GuildNewsThread` ->  `AnnouncementThread`
  • Loading branch information
almeidx committed Aug 29, 2022
1 parent 73d15dd commit 8178841
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 76 deletions.
30 changes: 14 additions & 16 deletions deno/payloads/v10/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ export interface APIChannelBase<T extends ChannelType> extends APIPartialChannel
export type TextChannelType =
| ChannelType.DM
| ChannelType.GroupDM
| ChannelType.GuildNews
| ChannelType.GuildPublicThread
| ChannelType.GuildPrivateThread
| ChannelType.GuildNewsThread
| ChannelType.GuildAnnouncement
| ChannelType.PublicThread
| ChannelType.PrivateThread
| ChannelType.AnnouncementThread
| ChannelType.GuildText
| ChannelType.GuildForum
| ChannelType.GuildVoice;

export type GuildChannelType = Exclude<
TextChannelType | ChannelType.GuildVoice | ChannelType.GuildStageVoice | ChannelType.GuildNews,
TextChannelType | ChannelType.GuildVoice | ChannelType.GuildStageVoice | ChannelType.GuildAnnouncement,
ChannelType.DM | ChannelType.GroupDM
>;

Expand Down Expand Up @@ -122,7 +122,7 @@ export interface APIGuildTextChannel<T extends GuildTextChannelType>
}

export type APITextChannel = APIGuildTextChannel<ChannelType.GuildText>;
export type APINewsChannel = APIGuildTextChannel<ChannelType.GuildNews>;
export type APINewsChannel = APIGuildTextChannel<ChannelType.GuildAnnouncement>;
export type APIGuildCategoryChannel = APIGuildChannel<ChannelType.GuildCategory>;

export interface APIVoiceChannelBase<T extends ChannelType> extends APIGuildChannel<T> {
Expand Down Expand Up @@ -190,9 +190,7 @@ export interface APIGroupDMChannel extends Omit<APIDMChannelBase<ChannelType.Gro
}

export interface APIThreadChannel
extends APIGuildChannel<
ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread | ChannelType.GuildNewsThread
> {
extends APIGuildChannel<ChannelType.PublicThread | ChannelType.PrivateThread | ChannelType.AnnouncementThread> {
/**
* The client users member for the thread, only included in select endpoints
*/
Expand Down Expand Up @@ -285,19 +283,19 @@ export enum ChannelType {
*
* See https://support.discord.com/hc/en-us/articles/360032008192
*/
GuildNews,
GuildAnnouncement,
/**
* A thread channel (public) within a Guild News channel
* A temporary sub-channel within a Guild Announcement channel
*/
GuildNewsThread = 10,
AnnouncementThread = 10,
/**
* A public thread channel within a Guild Text channel
* A temporary sub-channel within a Guild Text channel
*/
GuildPublicThread,
PublicThread,
/**
* A private thread channel within a Guild Text channel
* A temporary sub-channel within a Guild Text channel that is only viewable by those invited and those with the Manage Threads permission
*/
GuildPrivateThread,
PrivateThread,
/**
* A voice channel for hosting events with an audience
*
Expand Down
30 changes: 14 additions & 16 deletions deno/payloads/v9/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ export interface APIChannelBase<T extends ChannelType> extends APIPartialChannel
export type TextChannelType =
| ChannelType.DM
| ChannelType.GroupDM
| ChannelType.GuildNews
| ChannelType.GuildPublicThread
| ChannelType.GuildPrivateThread
| ChannelType.GuildNewsThread
| ChannelType.GuildAnnouncement
| ChannelType.PublicThread
| ChannelType.PrivateThread
| ChannelType.AnnouncementThread
| ChannelType.GuildText
| ChannelType.GuildForum
| ChannelType.GuildVoice;

export type GuildChannelType = Exclude<
TextChannelType | ChannelType.GuildVoice | ChannelType.GuildStageVoice | ChannelType.GuildNews,
TextChannelType | ChannelType.GuildVoice | ChannelType.GuildStageVoice | ChannelType.GuildAnnouncement,
ChannelType.DM | ChannelType.GroupDM
>;

Expand Down Expand Up @@ -122,7 +122,7 @@ export interface APIGuildTextChannel<T extends GuildTextChannelType>
}

export type APITextChannel = APIGuildTextChannel<ChannelType.GuildText>;
export type APINewsChannel = APIGuildTextChannel<ChannelType.GuildNews>;
export type APINewsChannel = APIGuildTextChannel<ChannelType.GuildAnnouncement>;
export type APIGuildCategoryChannel = APIGuildChannel<ChannelType.GuildCategory>;

export interface APIVoiceChannelBase<T extends ChannelType> extends APIGuildChannel<T> {
Expand Down Expand Up @@ -190,9 +190,7 @@ export interface APIGroupDMChannel extends Omit<APIDMChannelBase<ChannelType.Gro
}

export interface APIThreadChannel
extends APIGuildChannel<
ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread | ChannelType.GuildNewsThread
> {
extends APIGuildChannel<ChannelType.PublicThread | ChannelType.PrivateThread | ChannelType.AnnouncementThread> {
/**
* The client users member for the thread, only included in select endpoints
*/
Expand Down Expand Up @@ -285,19 +283,19 @@ export enum ChannelType {
*
* See https://support.discord.com/hc/en-us/articles/360032008192
*/
GuildNews,
GuildAnnouncement,
/**
* A thread channel (public) within a Guild News channel
* A temporary sub-channel within a Guild Announcement channel
*/
GuildNewsThread = 10,
AnnouncementThread = 10,
/**
* A public thread channel within a Guild Text channel
* A temporary sub-channel within a Guild Text channel
*/
GuildPublicThread,
PublicThread,
/**
* A private thread channel within a Guild Text channel
* A temporary sub-channel within a Guild Text channel that is only viewable by those invited and those with the Manage Threads permission
*/
GuildPrivateThread,
PrivateThread,
/**
* A voice channel for hosting events with an audience
*
Expand Down
6 changes: 3 additions & 3 deletions deno/rest/v10/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
*
* Channel types: text, news
*/
type?: ChannelType.GuildNews | ChannelType.GuildText;
type?: ChannelType.GuildAnnouncement | ChannelType.GuildText;
/**
* The position of the channel in the left-hand listing
*
Expand Down Expand Up @@ -619,9 +619,9 @@ export type RESTPostAPIChannelThreadsJSONBody = RESTPostAPIChannelMessagesThread
*
* See https://discord.com/developers/docs/resources/channel#channel-object-channel-types
*
* @default ChannelType.GuildPrivateThread
* @default ChannelType.PrivateThread
*/
type?: ChannelType.GuildNewsThread | ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread;
type?: ChannelType.AnnouncementThread | ChannelType.PublicThread | ChannelType.PrivateThread;
/**
* Whether non-moderators can add other non-moderators to the thread; only available when creating a private thread
*/
Expand Down
6 changes: 3 additions & 3 deletions deno/rest/v9/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
*
* Channel types: text, news
*/
type?: ChannelType.GuildNews | ChannelType.GuildText;
type?: ChannelType.GuildAnnouncement | ChannelType.GuildText;
/**
* The position of the channel in the left-hand listing
*
Expand Down Expand Up @@ -633,9 +633,9 @@ export type RESTPostAPIChannelThreadsJSONBody = RESTPostAPIChannelMessagesThread
*
* See https://discord.com/developers/docs/resources/channel#channel-object-channel-types
*
* @default ChannelType.GuildPrivateThread
* @default ChannelType.PrivateThread
*/
type?: ChannelType.GuildNewsThread | ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread;
type?: ChannelType.AnnouncementThread | ChannelType.PublicThread | ChannelType.PrivateThread;
/**
* Whether non-moderators can add other non-moderators to the thread; only available when creating a private thread
*/
Expand Down
30 changes: 14 additions & 16 deletions payloads/v10/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ export interface APIChannelBase<T extends ChannelType> extends APIPartialChannel
export type TextChannelType =
| ChannelType.DM
| ChannelType.GroupDM
| ChannelType.GuildNews
| ChannelType.GuildPublicThread
| ChannelType.GuildPrivateThread
| ChannelType.GuildNewsThread
| ChannelType.GuildAnnouncement
| ChannelType.PublicThread
| ChannelType.PrivateThread
| ChannelType.AnnouncementThread
| ChannelType.GuildText
| ChannelType.GuildForum
| ChannelType.GuildVoice;

export type GuildChannelType = Exclude<
TextChannelType | ChannelType.GuildVoice | ChannelType.GuildStageVoice | ChannelType.GuildNews,
TextChannelType | ChannelType.GuildVoice | ChannelType.GuildStageVoice | ChannelType.GuildAnnouncement,
ChannelType.DM | ChannelType.GroupDM
>;

Expand Down Expand Up @@ -122,7 +122,7 @@ export interface APIGuildTextChannel<T extends GuildTextChannelType>
}

export type APITextChannel = APIGuildTextChannel<ChannelType.GuildText>;
export type APINewsChannel = APIGuildTextChannel<ChannelType.GuildNews>;
export type APINewsChannel = APIGuildTextChannel<ChannelType.GuildAnnouncement>;
export type APIGuildCategoryChannel = APIGuildChannel<ChannelType.GuildCategory>;

export interface APIVoiceChannelBase<T extends ChannelType> extends APIGuildChannel<T> {
Expand Down Expand Up @@ -190,9 +190,7 @@ export interface APIGroupDMChannel extends Omit<APIDMChannelBase<ChannelType.Gro
}

export interface APIThreadChannel
extends APIGuildChannel<
ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread | ChannelType.GuildNewsThread
> {
extends APIGuildChannel<ChannelType.PublicThread | ChannelType.PrivateThread | ChannelType.AnnouncementThread> {
/**
* The client users member for the thread, only included in select endpoints
*/
Expand Down Expand Up @@ -285,19 +283,19 @@ export enum ChannelType {
*
* See https://support.discord.com/hc/en-us/articles/360032008192
*/
GuildNews,
GuildAnnouncement,
/**
* A thread channel (public) within a Guild News channel
* A temporary sub-channel within a Guild Announcement channel
*/
GuildNewsThread = 10,
AnnouncementThread = 10,
/**
* A public thread channel within a Guild Text channel
* A temporary sub-channel within a Guild Text channel
*/
GuildPublicThread,
PublicThread,
/**
* A private thread channel within a Guild Text channel
* A temporary sub-channel within a Guild Text channel that is only viewable by those invited and those with the Manage Threads permission
*/
GuildPrivateThread,
PrivateThread,
/**
* A voice channel for hosting events with an audience
*
Expand Down
30 changes: 14 additions & 16 deletions payloads/v9/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ export interface APIChannelBase<T extends ChannelType> extends APIPartialChannel
export type TextChannelType =
| ChannelType.DM
| ChannelType.GroupDM
| ChannelType.GuildNews
| ChannelType.GuildPublicThread
| ChannelType.GuildPrivateThread
| ChannelType.GuildNewsThread
| ChannelType.GuildAnnouncement
| ChannelType.PublicThread
| ChannelType.PrivateThread
| ChannelType.AnnouncementThread
| ChannelType.GuildText
| ChannelType.GuildForum
| ChannelType.GuildVoice;

export type GuildChannelType = Exclude<
TextChannelType | ChannelType.GuildVoice | ChannelType.GuildStageVoice | ChannelType.GuildNews,
TextChannelType | ChannelType.GuildVoice | ChannelType.GuildStageVoice | ChannelType.GuildAnnouncement,
ChannelType.DM | ChannelType.GroupDM
>;

Expand Down Expand Up @@ -122,7 +122,7 @@ export interface APIGuildTextChannel<T extends GuildTextChannelType>
}

export type APITextChannel = APIGuildTextChannel<ChannelType.GuildText>;
export type APINewsChannel = APIGuildTextChannel<ChannelType.GuildNews>;
export type APINewsChannel = APIGuildTextChannel<ChannelType.GuildAnnouncement>;
export type APIGuildCategoryChannel = APIGuildChannel<ChannelType.GuildCategory>;

export interface APIVoiceChannelBase<T extends ChannelType> extends APIGuildChannel<T> {
Expand Down Expand Up @@ -190,9 +190,7 @@ export interface APIGroupDMChannel extends Omit<APIDMChannelBase<ChannelType.Gro
}

export interface APIThreadChannel
extends APIGuildChannel<
ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread | ChannelType.GuildNewsThread
> {
extends APIGuildChannel<ChannelType.PublicThread | ChannelType.PrivateThread | ChannelType.AnnouncementThread> {
/**
* The client users member for the thread, only included in select endpoints
*/
Expand Down Expand Up @@ -285,19 +283,19 @@ export enum ChannelType {
*
* See https://support.discord.com/hc/en-us/articles/360032008192
*/
GuildNews,
GuildAnnouncement,
/**
* A thread channel (public) within a Guild News channel
* A temporary sub-channel within a Guild Announcement channel
*/
GuildNewsThread = 10,
AnnouncementThread = 10,
/**
* A public thread channel within a Guild Text channel
* A temporary sub-channel within a Guild Text channel
*/
GuildPublicThread,
PublicThread,
/**
* A private thread channel within a Guild Text channel
* A temporary sub-channel within a Guild Text channel that is only viewable by those invited and those with the Manage Threads permission
*/
GuildPrivateThread,
PrivateThread,
/**
* A voice channel for hosting events with an audience
*
Expand Down
6 changes: 3 additions & 3 deletions rest/v10/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
*
* Channel types: text, news
*/
type?: ChannelType.GuildNews | ChannelType.GuildText;
type?: ChannelType.GuildAnnouncement | ChannelType.GuildText;
/**
* The position of the channel in the left-hand listing
*
Expand Down Expand Up @@ -619,9 +619,9 @@ export type RESTPostAPIChannelThreadsJSONBody = RESTPostAPIChannelMessagesThread
*
* See https://discord.com/developers/docs/resources/channel#channel-object-channel-types
*
* @default ChannelType.GuildPrivateThread
* @default ChannelType.PrivateThread
*/
type?: ChannelType.GuildNewsThread | ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread;
type?: ChannelType.AnnouncementThread | ChannelType.PublicThread | ChannelType.PrivateThread;
/**
* Whether non-moderators can add other non-moderators to the thread; only available when creating a private thread
*/
Expand Down
6 changes: 3 additions & 3 deletions rest/v9/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
*
* Channel types: text, news
*/
type?: ChannelType.GuildNews | ChannelType.GuildText;
type?: ChannelType.GuildAnnouncement | ChannelType.GuildText;
/**
* The position of the channel in the left-hand listing
*
Expand Down Expand Up @@ -633,9 +633,9 @@ export type RESTPostAPIChannelThreadsJSONBody = RESTPostAPIChannelMessagesThread
*
* See https://discord.com/developers/docs/resources/channel#channel-object-channel-types
*
* @default ChannelType.GuildPrivateThread
* @default ChannelType.PrivateThread
*/
type?: ChannelType.GuildNewsThread | ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread;
type?: ChannelType.AnnouncementThread | ChannelType.PublicThread | ChannelType.PrivateThread;
/**
* Whether non-moderators can add other non-moderators to the thread; only available when creating a private thread
*/
Expand Down

0 comments on commit 8178841

Please sign in to comment.