mirror of
https://github.com/discordjs/discord-api-types.git
synced 2026-06-03 01:10:09 +00:00
fix: discriminated thread channel types (#1247)
This commit is contained in:
36
deno/payloads/v10/channel.ts
generated
36
deno/payloads/v10/channel.ts
generated
@@ -98,6 +98,13 @@ export interface APITextBasedChannel<T extends ChannelType> extends APIChannelBa
|
||||
rate_limit_per_user?: number;
|
||||
}
|
||||
|
||||
export interface APISortableChannel {
|
||||
/**
|
||||
* Sorting position of the channel
|
||||
*/
|
||||
position: number;
|
||||
}
|
||||
|
||||
export interface APIGuildChannel<T extends ChannelType> extends Omit<APIChannelBase<T>, 'name'> {
|
||||
/**
|
||||
* The name of the channel (1-100 characters)
|
||||
@@ -113,10 +120,6 @@ export interface APIGuildChannel<T extends ChannelType> extends Omit<APIChannelB
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#overwrite-object}
|
||||
*/
|
||||
permission_overwrites?: APIOverwrite[];
|
||||
/**
|
||||
* Sorting position of the channel
|
||||
*/
|
||||
position: number;
|
||||
/**
|
||||
* ID of the parent category for a channel (each parent category can contain up to 50 channels)
|
||||
*
|
||||
@@ -135,7 +138,8 @@ export type GuildTextChannelType = Exclude<TextChannelType, ChannelType.DM | Cha
|
||||
|
||||
export interface APIGuildTextChannel<T extends ChannelType.GuildForum | ChannelType.GuildMedia | GuildTextChannelType>
|
||||
extends Omit<APITextBasedChannel<T>, 'name'>,
|
||||
APIGuildChannel<T> {
|
||||
APIGuildChannel<T>,
|
||||
APISortableChannel {
|
||||
/**
|
||||
* Default duration for newly created threads, in minutes, to automatically archive the thread after recent activity
|
||||
*/
|
||||
@@ -153,10 +157,11 @@ export interface APIGuildTextChannel<T extends ChannelType.GuildForum | ChannelT
|
||||
|
||||
export type APITextChannel = APIGuildTextChannel<ChannelType.GuildText>;
|
||||
export type APINewsChannel = APIGuildTextChannel<ChannelType.GuildAnnouncement>;
|
||||
export type APIGuildCategoryChannel = APIGuildChannel<ChannelType.GuildCategory>;
|
||||
export interface APIGuildCategoryChannel extends APIGuildChannel<ChannelType.GuildCategory>, APISortableChannel {}
|
||||
|
||||
export interface APIVoiceChannelBase<T extends ChannelType>
|
||||
extends APIGuildChannel<T>,
|
||||
APISortableChannel,
|
||||
Omit<APITextBasedChannel<T>, 'last_pin_timestamp' | 'name'> {
|
||||
/**
|
||||
* The bitrate (in bits) of the voice or stage channel
|
||||
@@ -229,9 +234,9 @@ export interface APIGroupDMChannel extends Omit<APIDMChannelBase<ChannelType.Gro
|
||||
|
||||
export type ThreadChannelType = ChannelType.AnnouncementThread | ChannelType.PrivateThread | ChannelType.PublicThread;
|
||||
|
||||
export interface APIThreadChannel
|
||||
extends Omit<APITextBasedChannel<ThreadChannelType>, 'name'>,
|
||||
APIGuildChannel<ThreadChannelType> {
|
||||
export interface APIThreadChannel<Type extends ThreadChannelType = ThreadChannelType>
|
||||
extends Omit<APITextBasedChannel<Type>, 'name'>,
|
||||
APIGuildChannel<Type> {
|
||||
/**
|
||||
* The client users member for the thread, only included in select endpoints
|
||||
*/
|
||||
@@ -266,6 +271,10 @@ export interface APIThreadChannel
|
||||
applied_tags: Snowflake[];
|
||||
}
|
||||
|
||||
export type APIPublicThreadChannel = APIThreadChannel<ChannelType.PublicThread>;
|
||||
export type APIPrivateThreadChannel = APIThreadChannel<ChannelType.PrivateThread>;
|
||||
export type APIAnnouncementThreadChannel = APIThreadChannel<ChannelType.AnnouncementThread>;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#forum-tag-object-forum-tag-structure}
|
||||
*/
|
||||
@@ -339,7 +348,8 @@ export enum ForumLayoutType {
|
||||
}
|
||||
|
||||
export interface APIThreadOnlyChannel<T extends ChannelType.GuildForum | ChannelType.GuildMedia>
|
||||
extends APIGuildChannel<T> {
|
||||
extends APIGuildChannel<T>,
|
||||
APISortableChannel {
|
||||
/**
|
||||
* The channel topic (0-4096 characters)
|
||||
*/
|
||||
@@ -398,6 +408,7 @@ export type APIGuildMediaChannel = APIThreadOnlyChannel<ChannelType.GuildMedia>;
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#channel-object-channel-structure}
|
||||
*/
|
||||
export type APIChannel =
|
||||
| APIAnnouncementThreadChannel
|
||||
| APIDMChannel
|
||||
| APIGroupDMChannel
|
||||
| APIGuildCategoryChannel
|
||||
@@ -406,8 +417,9 @@ export type APIChannel =
|
||||
| APIGuildStageVoiceChannel
|
||||
| APIGuildVoiceChannel
|
||||
| APINewsChannel
|
||||
| APITextChannel
|
||||
| APIThreadChannel;
|
||||
| APIPrivateThreadChannel
|
||||
| APIPublicThreadChannel
|
||||
| APITextChannel;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#channel-object-channel-types}
|
||||
|
||||
2
deno/payloads/v9/auditLog.ts
generated
2
deno/payloads/v9/auditLog.ts
generated
@@ -325,7 +325,7 @@ export interface APIAuditLogOptions {
|
||||
* - CHANNEL_OVERWRITE_UPDATE
|
||||
* - CHANNEL_OVERWRITE_DELETE
|
||||
*
|
||||
* **Present only if the {@link APIAuditLogOptions.type | entry type} is "0"**
|
||||
* **Present only if the {@link APIAuditLogOptions."type" | entry type} is "0"**
|
||||
*/
|
||||
role_name?: string;
|
||||
|
||||
|
||||
34
deno/payloads/v9/channel.ts
generated
34
deno/payloads/v9/channel.ts
generated
@@ -98,6 +98,13 @@ export interface APITextBasedChannel<T extends ChannelType> extends APIChannelBa
|
||||
rate_limit_per_user?: number;
|
||||
}
|
||||
|
||||
export interface APISortableChannel {
|
||||
/**
|
||||
* Sorting position of the channel
|
||||
*/
|
||||
position: number;
|
||||
}
|
||||
|
||||
export interface APIGuildChannel<T extends ChannelType> extends Omit<APIChannelBase<T>, 'name'> {
|
||||
/**
|
||||
* The name of the channel (1-100 characters)
|
||||
@@ -113,10 +120,6 @@ export interface APIGuildChannel<T extends ChannelType> extends Omit<APIChannelB
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#overwrite-object}
|
||||
*/
|
||||
permission_overwrites?: APIOverwrite[];
|
||||
/**
|
||||
* Sorting position of the channel
|
||||
*/
|
||||
position: number;
|
||||
/**
|
||||
* ID of the parent category for a channel (each parent category can contain up to 50 channels)
|
||||
*
|
||||
@@ -135,6 +138,7 @@ export type GuildTextChannelType = Exclude<TextChannelType, ChannelType.DM | Cha
|
||||
|
||||
export interface APIGuildTextChannel<T extends ChannelType.GuildForum | ChannelType.GuildMedia | GuildTextChannelType>
|
||||
extends Omit<APITextBasedChannel<T>, 'name'>,
|
||||
APISortableChannel,
|
||||
APIGuildChannel<T> {
|
||||
/**
|
||||
* Default duration for newly created threads, in minutes, to automatically archive the thread after recent activity
|
||||
@@ -153,10 +157,11 @@ export interface APIGuildTextChannel<T extends ChannelType.GuildForum | ChannelT
|
||||
|
||||
export type APITextChannel = APIGuildTextChannel<ChannelType.GuildText>;
|
||||
export type APINewsChannel = APIGuildTextChannel<ChannelType.GuildAnnouncement>;
|
||||
export type APIGuildCategoryChannel = APIGuildChannel<ChannelType.GuildCategory>;
|
||||
export interface APIGuildCategoryChannel extends APIGuildChannel<ChannelType.GuildCategory>, APISortableChannel {}
|
||||
|
||||
export interface APIVoiceChannelBase<T extends ChannelType>
|
||||
extends APIGuildChannel<T>,
|
||||
APISortableChannel,
|
||||
Omit<APITextBasedChannel<T>, 'last_pin_timestamp' | 'name'> {
|
||||
/**
|
||||
* The bitrate (in bits) of the voice or stage channel
|
||||
@@ -229,9 +234,9 @@ export interface APIGroupDMChannel extends Omit<APIDMChannelBase<ChannelType.Gro
|
||||
|
||||
export type ThreadChannelType = ChannelType.AnnouncementThread | ChannelType.PrivateThread | ChannelType.PublicThread;
|
||||
|
||||
export interface APIThreadChannel
|
||||
extends Omit<APITextBasedChannel<ThreadChannelType>, 'name'>,
|
||||
APIGuildChannel<ThreadChannelType> {
|
||||
export interface APIThreadChannel<Type extends ThreadChannelType = ThreadChannelType>
|
||||
extends Omit<APITextBasedChannel<Type>, 'name'>,
|
||||
APIGuildChannel<Type> {
|
||||
/**
|
||||
* The client users member for the thread, only included in select endpoints
|
||||
*/
|
||||
@@ -266,6 +271,10 @@ export interface APIThreadChannel
|
||||
applied_tags: Snowflake[];
|
||||
}
|
||||
|
||||
export type APIPublicThreadChannel = APIThreadChannel<ChannelType.PublicThread>;
|
||||
export type APIPrivateThreadChannel = APIThreadChannel<ChannelType.PrivateThread>;
|
||||
export type APIAnnouncementThreadChannel = APIThreadChannel<ChannelType.AnnouncementThread>;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#forum-tag-object-forum-tag-structure}
|
||||
*/
|
||||
@@ -339,7 +348,8 @@ export enum ForumLayoutType {
|
||||
}
|
||||
|
||||
export interface APIThreadOnlyChannel<T extends ChannelType.GuildForum | ChannelType.GuildMedia>
|
||||
extends APIGuildChannel<T> {
|
||||
extends APIGuildChannel<T>,
|
||||
APISortableChannel {
|
||||
/**
|
||||
* The channel topic (0-4096 characters)
|
||||
*/
|
||||
@@ -398,6 +408,7 @@ export type APIGuildMediaChannel = APIThreadOnlyChannel<ChannelType.GuildMedia>;
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#channel-object-channel-structure}
|
||||
*/
|
||||
export type APIChannel =
|
||||
| APIAnnouncementThreadChannel
|
||||
| APIDMChannel
|
||||
| APIGroupDMChannel
|
||||
| APIGuildCategoryChannel
|
||||
@@ -406,8 +417,9 @@ export type APIChannel =
|
||||
| APIGuildStageVoiceChannel
|
||||
| APIGuildVoiceChannel
|
||||
| APINewsChannel
|
||||
| APITextChannel
|
||||
| APIThreadChannel;
|
||||
| APIPrivateThreadChannel
|
||||
| APIPublicThreadChannel
|
||||
| APITextChannel;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#channel-object-channel-types}
|
||||
|
||||
@@ -98,6 +98,13 @@ export interface APITextBasedChannel<T extends ChannelType> extends APIChannelBa
|
||||
rate_limit_per_user?: number;
|
||||
}
|
||||
|
||||
export interface APISortableChannel {
|
||||
/**
|
||||
* Sorting position of the channel
|
||||
*/
|
||||
position: number;
|
||||
}
|
||||
|
||||
export interface APIGuildChannel<T extends ChannelType> extends Omit<APIChannelBase<T>, 'name'> {
|
||||
/**
|
||||
* The name of the channel (1-100 characters)
|
||||
@@ -113,10 +120,6 @@ export interface APIGuildChannel<T extends ChannelType> extends Omit<APIChannelB
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#overwrite-object}
|
||||
*/
|
||||
permission_overwrites?: APIOverwrite[];
|
||||
/**
|
||||
* Sorting position of the channel
|
||||
*/
|
||||
position: number;
|
||||
/**
|
||||
* ID of the parent category for a channel (each parent category can contain up to 50 channels)
|
||||
*
|
||||
@@ -135,7 +138,8 @@ export type GuildTextChannelType = Exclude<TextChannelType, ChannelType.DM | Cha
|
||||
|
||||
export interface APIGuildTextChannel<T extends ChannelType.GuildForum | ChannelType.GuildMedia | GuildTextChannelType>
|
||||
extends Omit<APITextBasedChannel<T>, 'name'>,
|
||||
APIGuildChannel<T> {
|
||||
APIGuildChannel<T>,
|
||||
APISortableChannel {
|
||||
/**
|
||||
* Default duration for newly created threads, in minutes, to automatically archive the thread after recent activity
|
||||
*/
|
||||
@@ -153,10 +157,11 @@ export interface APIGuildTextChannel<T extends ChannelType.GuildForum | ChannelT
|
||||
|
||||
export type APITextChannel = APIGuildTextChannel<ChannelType.GuildText>;
|
||||
export type APINewsChannel = APIGuildTextChannel<ChannelType.GuildAnnouncement>;
|
||||
export type APIGuildCategoryChannel = APIGuildChannel<ChannelType.GuildCategory>;
|
||||
export interface APIGuildCategoryChannel extends APIGuildChannel<ChannelType.GuildCategory>, APISortableChannel {}
|
||||
|
||||
export interface APIVoiceChannelBase<T extends ChannelType>
|
||||
extends APIGuildChannel<T>,
|
||||
APISortableChannel,
|
||||
Omit<APITextBasedChannel<T>, 'last_pin_timestamp' | 'name'> {
|
||||
/**
|
||||
* The bitrate (in bits) of the voice or stage channel
|
||||
@@ -229,9 +234,9 @@ export interface APIGroupDMChannel extends Omit<APIDMChannelBase<ChannelType.Gro
|
||||
|
||||
export type ThreadChannelType = ChannelType.AnnouncementThread | ChannelType.PrivateThread | ChannelType.PublicThread;
|
||||
|
||||
export interface APIThreadChannel
|
||||
extends Omit<APITextBasedChannel<ThreadChannelType>, 'name'>,
|
||||
APIGuildChannel<ThreadChannelType> {
|
||||
export interface APIThreadChannel<Type extends ThreadChannelType = ThreadChannelType>
|
||||
extends Omit<APITextBasedChannel<Type>, 'name'>,
|
||||
APIGuildChannel<Type> {
|
||||
/**
|
||||
* The client users member for the thread, only included in select endpoints
|
||||
*/
|
||||
@@ -266,6 +271,10 @@ export interface APIThreadChannel
|
||||
applied_tags: Snowflake[];
|
||||
}
|
||||
|
||||
export type APIPublicThreadChannel = APIThreadChannel<ChannelType.PublicThread>;
|
||||
export type APIPrivateThreadChannel = APIThreadChannel<ChannelType.PrivateThread>;
|
||||
export type APIAnnouncementThreadChannel = APIThreadChannel<ChannelType.AnnouncementThread>;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#forum-tag-object-forum-tag-structure}
|
||||
*/
|
||||
@@ -339,7 +348,8 @@ export enum ForumLayoutType {
|
||||
}
|
||||
|
||||
export interface APIThreadOnlyChannel<T extends ChannelType.GuildForum | ChannelType.GuildMedia>
|
||||
extends APIGuildChannel<T> {
|
||||
extends APIGuildChannel<T>,
|
||||
APISortableChannel {
|
||||
/**
|
||||
* The channel topic (0-4096 characters)
|
||||
*/
|
||||
@@ -398,6 +408,7 @@ export type APIGuildMediaChannel = APIThreadOnlyChannel<ChannelType.GuildMedia>;
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#channel-object-channel-structure}
|
||||
*/
|
||||
export type APIChannel =
|
||||
| APIAnnouncementThreadChannel
|
||||
| APIDMChannel
|
||||
| APIGroupDMChannel
|
||||
| APIGuildCategoryChannel
|
||||
@@ -406,8 +417,9 @@ export type APIChannel =
|
||||
| APIGuildStageVoiceChannel
|
||||
| APIGuildVoiceChannel
|
||||
| APINewsChannel
|
||||
| APITextChannel
|
||||
| APIThreadChannel;
|
||||
| APIPrivateThreadChannel
|
||||
| APIPublicThreadChannel
|
||||
| APITextChannel;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#channel-object-channel-types}
|
||||
|
||||
@@ -325,7 +325,7 @@ export interface APIAuditLogOptions {
|
||||
* - CHANNEL_OVERWRITE_UPDATE
|
||||
* - CHANNEL_OVERWRITE_DELETE
|
||||
*
|
||||
* **Present only if the {@link APIAuditLogOptions.type | entry type} is "0"**
|
||||
* **Present only if the {@link APIAuditLogOptions."type" | entry type} is "0"**
|
||||
*/
|
||||
role_name?: string;
|
||||
|
||||
|
||||
@@ -98,6 +98,13 @@ export interface APITextBasedChannel<T extends ChannelType> extends APIChannelBa
|
||||
rate_limit_per_user?: number;
|
||||
}
|
||||
|
||||
export interface APISortableChannel {
|
||||
/**
|
||||
* Sorting position of the channel
|
||||
*/
|
||||
position: number;
|
||||
}
|
||||
|
||||
export interface APIGuildChannel<T extends ChannelType> extends Omit<APIChannelBase<T>, 'name'> {
|
||||
/**
|
||||
* The name of the channel (1-100 characters)
|
||||
@@ -113,10 +120,6 @@ export interface APIGuildChannel<T extends ChannelType> extends Omit<APIChannelB
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#overwrite-object}
|
||||
*/
|
||||
permission_overwrites?: APIOverwrite[];
|
||||
/**
|
||||
* Sorting position of the channel
|
||||
*/
|
||||
position: number;
|
||||
/**
|
||||
* ID of the parent category for a channel (each parent category can contain up to 50 channels)
|
||||
*
|
||||
@@ -135,6 +138,7 @@ export type GuildTextChannelType = Exclude<TextChannelType, ChannelType.DM | Cha
|
||||
|
||||
export interface APIGuildTextChannel<T extends ChannelType.GuildForum | ChannelType.GuildMedia | GuildTextChannelType>
|
||||
extends Omit<APITextBasedChannel<T>, 'name'>,
|
||||
APISortableChannel,
|
||||
APIGuildChannel<T> {
|
||||
/**
|
||||
* Default duration for newly created threads, in minutes, to automatically archive the thread after recent activity
|
||||
@@ -153,10 +157,11 @@ export interface APIGuildTextChannel<T extends ChannelType.GuildForum | ChannelT
|
||||
|
||||
export type APITextChannel = APIGuildTextChannel<ChannelType.GuildText>;
|
||||
export type APINewsChannel = APIGuildTextChannel<ChannelType.GuildAnnouncement>;
|
||||
export type APIGuildCategoryChannel = APIGuildChannel<ChannelType.GuildCategory>;
|
||||
export interface APIGuildCategoryChannel extends APIGuildChannel<ChannelType.GuildCategory>, APISortableChannel {}
|
||||
|
||||
export interface APIVoiceChannelBase<T extends ChannelType>
|
||||
extends APIGuildChannel<T>,
|
||||
APISortableChannel,
|
||||
Omit<APITextBasedChannel<T>, 'last_pin_timestamp' | 'name'> {
|
||||
/**
|
||||
* The bitrate (in bits) of the voice or stage channel
|
||||
@@ -229,9 +234,9 @@ export interface APIGroupDMChannel extends Omit<APIDMChannelBase<ChannelType.Gro
|
||||
|
||||
export type ThreadChannelType = ChannelType.AnnouncementThread | ChannelType.PrivateThread | ChannelType.PublicThread;
|
||||
|
||||
export interface APIThreadChannel
|
||||
extends Omit<APITextBasedChannel<ThreadChannelType>, 'name'>,
|
||||
APIGuildChannel<ThreadChannelType> {
|
||||
export interface APIThreadChannel<Type extends ThreadChannelType = ThreadChannelType>
|
||||
extends Omit<APITextBasedChannel<Type>, 'name'>,
|
||||
APIGuildChannel<Type> {
|
||||
/**
|
||||
* The client users member for the thread, only included in select endpoints
|
||||
*/
|
||||
@@ -266,6 +271,10 @@ export interface APIThreadChannel
|
||||
applied_tags: Snowflake[];
|
||||
}
|
||||
|
||||
export type APIPublicThreadChannel = APIThreadChannel<ChannelType.PublicThread>;
|
||||
export type APIPrivateThreadChannel = APIThreadChannel<ChannelType.PrivateThread>;
|
||||
export type APIAnnouncementThreadChannel = APIThreadChannel<ChannelType.AnnouncementThread>;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#forum-tag-object-forum-tag-structure}
|
||||
*/
|
||||
@@ -339,7 +348,8 @@ export enum ForumLayoutType {
|
||||
}
|
||||
|
||||
export interface APIThreadOnlyChannel<T extends ChannelType.GuildForum | ChannelType.GuildMedia>
|
||||
extends APIGuildChannel<T> {
|
||||
extends APIGuildChannel<T>,
|
||||
APISortableChannel {
|
||||
/**
|
||||
* The channel topic (0-4096 characters)
|
||||
*/
|
||||
@@ -398,6 +408,7 @@ export type APIGuildMediaChannel = APIThreadOnlyChannel<ChannelType.GuildMedia>;
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#channel-object-channel-structure}
|
||||
*/
|
||||
export type APIChannel =
|
||||
| APIAnnouncementThreadChannel
|
||||
| APIDMChannel
|
||||
| APIGroupDMChannel
|
||||
| APIGuildCategoryChannel
|
||||
@@ -406,8 +417,9 @@ export type APIChannel =
|
||||
| APIGuildStageVoiceChannel
|
||||
| APIGuildVoiceChannel
|
||||
| APINewsChannel
|
||||
| APITextChannel
|
||||
| APIThreadChannel;
|
||||
| APIPrivateThreadChannel
|
||||
| APIPublicThreadChannel
|
||||
| APITextChannel;
|
||||
|
||||
/**
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#channel-object-channel-types}
|
||||
|
||||
Reference in New Issue
Block a user