diff --git a/deno/payloads/v10/channel.ts b/deno/payloads/v10/channel.ts index ee2f7d52..a37218c8 100644 --- a/deno/payloads/v10/channel.ts +++ b/deno/payloads/v10/channel.ts @@ -25,9 +25,9 @@ export interface APIPartialChannel { */ type: ChannelType; /** - * The name of the channel (2-100 characters) + * The name of the channel (1-100 characters) */ - name?: string; + name?: string | null; } /** @@ -69,7 +69,11 @@ export interface APITextBasedChannel extends APIChannelBa rate_limit_per_user?: number; } -export interface APIGuildChannel extends APIChannelBase { +export interface APIGuildChannel extends Omit, 'name'> { + /** + * The name of the channel (1-100 characters) + */ + name: string; /** * The id of the guild (may be missing for some channel objects received over gateway guild dispatches) */ @@ -101,7 +105,7 @@ export interface APIGuildChannel extends APIChannelBase; export interface APIGuildTextChannel - extends APITextBasedChannel, + extends Omit, 'name'>, APIGuildChannel { /** * Default duration for newly created threads, in minutes, to automatically archive the thread after recent activity @@ -141,7 +145,7 @@ export interface APIVoiceChannelBase extends APIGuildChan export interface APIGuildVoiceChannel extends APIVoiceChannelBase, - APITextBasedChannel { + Omit, 'name'> { /** * The camera video quality mode of the voice channel, `1` when not present * @@ -161,9 +165,18 @@ export interface APIDMChannelBase extends Omit; +export interface APIDMChannel extends Omit, 'name'> { + /** + * The name of the channel (always null for DM channels) + */ + name: null; +} export interface APIGroupDMChannel extends Omit, 'name'> { + /** + * The name of the channel (1-100 characters) + */ + name: string | null; /** * Application id of the group DM creator if it is bot-created */ @@ -172,10 +185,6 @@ export interface APIGroupDMChannel extends Omit extends APIChannelBa rate_limit_per_user?: number; } -export interface APIGuildChannel extends APIChannelBase { +export interface APIGuildChannel extends Omit, 'name'> { + /** + * The name of the channel (1-100 characters) + */ + name: string; /** * The id of the guild (may be missing for some channel objects received over gateway guild dispatches) */ @@ -101,7 +105,7 @@ export interface APIGuildChannel extends APIChannelBase; export interface APIGuildTextChannel - extends APITextBasedChannel, + extends Omit, 'name'>, APIGuildChannel { /** * Default duration for newly created threads, in minutes, to automatically archive the thread after recent activity @@ -141,7 +145,7 @@ export interface APIVoiceChannelBase extends APIGuildChan export interface APIGuildVoiceChannel extends APIVoiceChannelBase, - APITextBasedChannel { + Omit, 'name'> { /** * The camera video quality mode of the voice channel, `1` when not present * @@ -161,9 +165,18 @@ export interface APIDMChannelBase extends Omit; +export interface APIDMChannel extends Omit, 'name'> { + /** + * The name of the channel (always null for DM channels) + */ + name: null; +} export interface APIGroupDMChannel extends Omit, 'name'> { + /** + * The name of the channel (1-100 characters) + */ + name: string | null; /** * Application id of the group DM creator if it is bot-created */ @@ -172,10 +185,6 @@ export interface APIGroupDMChannel extends Omit extends APIChannelBa rate_limit_per_user?: number; } -export interface APIGuildChannel extends APIChannelBase { +export interface APIGuildChannel extends Omit, 'name'> { + /** + * The name of the channel (1-100 characters) + */ + name: string; /** * The id of the guild (may be missing for some channel objects received over gateway guild dispatches) */ @@ -101,7 +105,7 @@ export interface APIGuildChannel extends APIChannelBase; export interface APIGuildTextChannel - extends APITextBasedChannel, + extends Omit, 'name'>, APIGuildChannel { /** * Default duration for newly created threads, in minutes, to automatically archive the thread after recent activity @@ -141,7 +145,7 @@ export interface APIVoiceChannelBase extends APIGuildChan export interface APIGuildVoiceChannel extends APIVoiceChannelBase, - APITextBasedChannel { + Omit, 'name'> { /** * The camera video quality mode of the voice channel, `1` when not present * @@ -161,9 +165,18 @@ export interface APIDMChannelBase extends Omit; +export interface APIDMChannel extends Omit, 'name'> { + /** + * The name of the channel (always null for DM channels) + */ + name: null; +} export interface APIGroupDMChannel extends Omit, 'name'> { + /** + * The name of the channel (1-100 characters) + */ + name: string | null; /** * Application id of the group DM creator if it is bot-created */ @@ -172,10 +185,6 @@ export interface APIGroupDMChannel extends Omit extends APIChannelBa rate_limit_per_user?: number; } -export interface APIGuildChannel extends APIChannelBase { +export interface APIGuildChannel extends Omit, 'name'> { + /** + * The name of the channel (1-100 characters) + */ + name: string; /** * The id of the guild (may be missing for some channel objects received over gateway guild dispatches) */ @@ -101,7 +105,7 @@ export interface APIGuildChannel extends APIChannelBase; export interface APIGuildTextChannel - extends APITextBasedChannel, + extends Omit, 'name'>, APIGuildChannel { /** * Default duration for newly created threads, in minutes, to automatically archive the thread after recent activity @@ -141,7 +145,7 @@ export interface APIVoiceChannelBase extends APIGuildChan export interface APIGuildVoiceChannel extends APIVoiceChannelBase, - APITextBasedChannel { + Omit, 'name'> { /** * The camera video quality mode of the voice channel, `1` when not present * @@ -161,9 +165,18 @@ export interface APIDMChannelBase extends Omit; +export interface APIDMChannel extends Omit, 'name'> { + /** + * The name of the channel (always null for DM channels) + */ + name: null; +} export interface APIGroupDMChannel extends Omit, 'name'> { + /** + * The name of the channel (1-100 characters) + */ + name: string | null; /** * Application id of the group DM creator if it is bot-created */ @@ -172,10 +185,6 @@ export interface APIGroupDMChannel extends Omit; + +// Test channel names are properly typed +// Always non-null present for non-DM channels, always null for DM channel +expectType(partialChannel.name); +expectType(groupDMChannel.name); +expectType(dmChannel.name); +expectType(guildChannel.name);