From 4488d8fd2611a6547fc6149ba1cec5682340a119 Mon Sep 17 00:00:00 2001 From: MateoDeveloper <79017590+Mateo-tem@users.noreply.github.com> Date: Tue, 9 Aug 2022 15:39:54 -0500 Subject: [PATCH] feat(APIVoiceChannel): support text in voice, properties `last_message_id` and `rate_limit_per_user` (#544) --- deno/payloads/v10/channel.ts | 42 ++++++++++++++++++++---------------- deno/payloads/v9/channel.ts | 42 ++++++++++++++++++++---------------- payloads/v10/channel.ts | 42 ++++++++++++++++++++---------------- payloads/v9/channel.ts | 42 ++++++++++++++++++++---------------- 4 files changed, 96 insertions(+), 72 deletions(-) diff --git a/deno/payloads/v10/channel.ts b/deno/payloads/v10/channel.ts index 6239b110d..aa8ae7174 100644 --- a/deno/payloads/v10/channel.ts +++ b/deno/payloads/v10/channel.ts @@ -39,7 +39,6 @@ export interface APIChannelBase extends APIPartialChannel flags?: ChannelFlags; } -// TODO: update when text in voice is released export type TextChannelType = | ChannelType.DM | ChannelType.GroupDM @@ -48,7 +47,8 @@ export type TextChannelType = | ChannelType.GuildPrivateThread | ChannelType.GuildNewsThread | ChannelType.GuildText - | ChannelType.GuildForum; + | ChannelType.GuildForum + | ChannelType.GuildVoice; export type GuildChannelType = Exclude< TextChannelType | ChannelType.GuildVoice | ChannelType.GuildStageVoice | ChannelType.GuildNews, @@ -60,6 +60,16 @@ export interface APITextBasedChannel extends APIChannelBa * The id of the last message sent in this channel (may not point to an existing or valid message) */ last_message_id?: Snowflake | null; + /** + * Amount of seconds a user has to wait before sending another message (0-21600); + * bots, as well as users with the permission `MANAGE_MESSAGES` or `MANAGE_CHANNELS`, are unaffected + * + * `rate_limit_per_user` also applies to thread creation. Users can send one message and create one thread during each `rate_limit_per_user` interval. + * + * For thread channels, `rate_limit_per_user` is only returned if the field is set to a non-zero and non-null value. + * The absence of this field in API calls and Gateway events should indicate that slowmode has been reset to the default value. + */ + rate_limit_per_user?: number; } export interface APIGuildChannel extends APIChannelBase { @@ -111,23 +121,11 @@ export interface APIGuildTextChannel last_pin_timestamp?: string | null; } -export interface APITextChannel extends APIGuildTextChannel { - /** - * Amount of seconds a user has to wait before sending another message (0-21600); - * bots, as well as users with the permission `MANAGE_MESSAGES` or `MANAGE_CHANNELS`, are unaffected - * - * `rate_limit_per_user` also applies to thread creation. Users can send one message and create one thread during each `rate_limit_per_user` interval. - * - * For thread channels, `rate_limit_per_user` is only returned if the field is set to a non-zero and non-null value. - * The absence of this field in API calls and Gateway events should indicate that slowmode has been reset to the default value. - */ - rate_limit_per_user?: number; -} - +export type APITextChannel = APIGuildTextChannel; export type APINewsChannel = APIGuildTextChannel; export type APIGuildCategoryChannel = APIGuildChannel; -export interface APIVoiceChannel extends APIGuildChannel { +export interface APIVoiceChannelBase extends APIGuildChannel { /** * The bitrate (in bits) of the voice channel */ @@ -142,6 +140,11 @@ export interface APIVoiceChannel extends APIGuildChannel, + APITextBasedChannel { /** * The camera video quality mode of the voice channel, `1` when not present * @@ -150,7 +153,9 @@ export interface APIVoiceChannel extends APIGuildChannel extends APITextBasedChannel { +export type APIGuildStageVoiceChannel = APIVoiceChannelBase; + +export interface APIDMChannelBase extends Omit, 'rate_limit_per_user'> { /** * The recipients of the DM * @@ -242,7 +247,8 @@ export type APIChannel = | APIDMChannel | APITextChannel | APINewsChannel - | APIVoiceChannel + | APIGuildVoiceChannel + | APIGuildStageVoiceChannel | APIGuildCategoryChannel | APIThreadChannel | APINewsChannel diff --git a/deno/payloads/v9/channel.ts b/deno/payloads/v9/channel.ts index c9f20bdea..ca162afca 100644 --- a/deno/payloads/v9/channel.ts +++ b/deno/payloads/v9/channel.ts @@ -39,7 +39,6 @@ export interface APIChannelBase extends APIPartialChannel flags?: ChannelFlags; } -// TODO: update when text in voice is released export type TextChannelType = | ChannelType.DM | ChannelType.GroupDM @@ -48,7 +47,8 @@ export type TextChannelType = | ChannelType.GuildPrivateThread | ChannelType.GuildNewsThread | ChannelType.GuildText - | ChannelType.GuildForum; + | ChannelType.GuildForum + | ChannelType.GuildVoice; export type GuildChannelType = Exclude< TextChannelType | ChannelType.GuildVoice | ChannelType.GuildStageVoice | ChannelType.GuildNews, @@ -60,6 +60,16 @@ export interface APITextBasedChannel extends APIChannelBa * The id of the last message sent in this channel (may not point to an existing or valid message) */ last_message_id?: Snowflake | null; + /** + * Amount of seconds a user has to wait before sending another message (0-21600); + * bots, as well as users with the permission `MANAGE_MESSAGES` or `MANAGE_CHANNELS`, are unaffected + * + * `rate_limit_per_user` also applies to thread creation. Users can send one message and create one thread during each `rate_limit_per_user` interval. + * + * For thread channels, `rate_limit_per_user` is only returned if the field is set to a non-zero and non-null value. + * The absence of this field in API calls and Gateway events should indicate that slowmode has been reset to the default value. + */ + rate_limit_per_user?: number; } export interface APIGuildChannel extends APIChannelBase { @@ -111,23 +121,11 @@ export interface APIGuildTextChannel last_pin_timestamp?: string | null; } -export interface APITextChannel extends APIGuildTextChannel { - /** - * Amount of seconds a user has to wait before sending another message (0-21600); - * bots, as well as users with the permission `MANAGE_MESSAGES` or `MANAGE_CHANNELS`, are unaffected - * - * `rate_limit_per_user` also applies to thread creation. Users can send one message and create one thread during each `rate_limit_per_user` interval. - * - * For thread channels, `rate_limit_per_user` is only returned if the field is set to a non-zero and non-null value. - * The absence of this field in API calls and Gateway events should indicate that slowmode has been reset to the default value. - */ - rate_limit_per_user?: number; -} - +export type APITextChannel = APIGuildTextChannel; export type APINewsChannel = APIGuildTextChannel; export type APIGuildCategoryChannel = APIGuildChannel; -export interface APIVoiceChannel extends APIGuildChannel { +export interface APIVoiceChannelBase extends APIGuildChannel { /** * The bitrate (in bits) of the voice channel */ @@ -142,6 +140,11 @@ export interface APIVoiceChannel extends APIGuildChannel, + APITextBasedChannel { /** * The camera video quality mode of the voice channel, `1` when not present * @@ -150,7 +153,9 @@ export interface APIVoiceChannel extends APIGuildChannel extends APITextBasedChannel { +export type APIGuildStageVoiceChannel = APIVoiceChannelBase; + +export interface APIDMChannelBase extends Omit, 'rate_limit_per_user'> { /** * The recipients of the DM * @@ -242,7 +247,8 @@ export type APIChannel = | APIDMChannel | APITextChannel | APINewsChannel - | APIVoiceChannel + | APIGuildVoiceChannel + | APIGuildStageVoiceChannel | APIGuildCategoryChannel | APIThreadChannel | APINewsChannel diff --git a/payloads/v10/channel.ts b/payloads/v10/channel.ts index 09a7a41cc..7b877665d 100644 --- a/payloads/v10/channel.ts +++ b/payloads/v10/channel.ts @@ -39,7 +39,6 @@ export interface APIChannelBase extends APIPartialChannel flags?: ChannelFlags; } -// TODO: update when text in voice is released export type TextChannelType = | ChannelType.DM | ChannelType.GroupDM @@ -48,7 +47,8 @@ export type TextChannelType = | ChannelType.GuildPrivateThread | ChannelType.GuildNewsThread | ChannelType.GuildText - | ChannelType.GuildForum; + | ChannelType.GuildForum + | ChannelType.GuildVoice; export type GuildChannelType = Exclude< TextChannelType | ChannelType.GuildVoice | ChannelType.GuildStageVoice | ChannelType.GuildNews, @@ -60,6 +60,16 @@ export interface APITextBasedChannel extends APIChannelBa * The id of the last message sent in this channel (may not point to an existing or valid message) */ last_message_id?: Snowflake | null; + /** + * Amount of seconds a user has to wait before sending another message (0-21600); + * bots, as well as users with the permission `MANAGE_MESSAGES` or `MANAGE_CHANNELS`, are unaffected + * + * `rate_limit_per_user` also applies to thread creation. Users can send one message and create one thread during each `rate_limit_per_user` interval. + * + * For thread channels, `rate_limit_per_user` is only returned if the field is set to a non-zero and non-null value. + * The absence of this field in API calls and Gateway events should indicate that slowmode has been reset to the default value. + */ + rate_limit_per_user?: number; } export interface APIGuildChannel extends APIChannelBase { @@ -111,23 +121,11 @@ export interface APIGuildTextChannel last_pin_timestamp?: string | null; } -export interface APITextChannel extends APIGuildTextChannel { - /** - * Amount of seconds a user has to wait before sending another message (0-21600); - * bots, as well as users with the permission `MANAGE_MESSAGES` or `MANAGE_CHANNELS`, are unaffected - * - * `rate_limit_per_user` also applies to thread creation. Users can send one message and create one thread during each `rate_limit_per_user` interval. - * - * For thread channels, `rate_limit_per_user` is only returned if the field is set to a non-zero and non-null value. - * The absence of this field in API calls and Gateway events should indicate that slowmode has been reset to the default value. - */ - rate_limit_per_user?: number; -} - +export type APITextChannel = APIGuildTextChannel; export type APINewsChannel = APIGuildTextChannel; export type APIGuildCategoryChannel = APIGuildChannel; -export interface APIVoiceChannel extends APIGuildChannel { +export interface APIVoiceChannelBase extends APIGuildChannel { /** * The bitrate (in bits) of the voice channel */ @@ -142,6 +140,11 @@ export interface APIVoiceChannel extends APIGuildChannel, + APITextBasedChannel { /** * The camera video quality mode of the voice channel, `1` when not present * @@ -150,7 +153,9 @@ export interface APIVoiceChannel extends APIGuildChannel extends APITextBasedChannel { +export type APIGuildStageVoiceChannel = APIVoiceChannelBase; + +export interface APIDMChannelBase extends Omit, 'rate_limit_per_user'> { /** * The recipients of the DM * @@ -242,7 +247,8 @@ export type APIChannel = | APIDMChannel | APITextChannel | APINewsChannel - | APIVoiceChannel + | APIGuildVoiceChannel + | APIGuildStageVoiceChannel | APIGuildCategoryChannel | APIThreadChannel | APINewsChannel diff --git a/payloads/v9/channel.ts b/payloads/v9/channel.ts index d12c7073f..5d36404bc 100644 --- a/payloads/v9/channel.ts +++ b/payloads/v9/channel.ts @@ -39,7 +39,6 @@ export interface APIChannelBase extends APIPartialChannel flags?: ChannelFlags; } -// TODO: update when text in voice is released export type TextChannelType = | ChannelType.DM | ChannelType.GroupDM @@ -48,7 +47,8 @@ export type TextChannelType = | ChannelType.GuildPrivateThread | ChannelType.GuildNewsThread | ChannelType.GuildText - | ChannelType.GuildForum; + | ChannelType.GuildForum + | ChannelType.GuildVoice; export type GuildChannelType = Exclude< TextChannelType | ChannelType.GuildVoice | ChannelType.GuildStageVoice | ChannelType.GuildNews, @@ -60,6 +60,16 @@ export interface APITextBasedChannel extends APIChannelBa * The id of the last message sent in this channel (may not point to an existing or valid message) */ last_message_id?: Snowflake | null; + /** + * Amount of seconds a user has to wait before sending another message (0-21600); + * bots, as well as users with the permission `MANAGE_MESSAGES` or `MANAGE_CHANNELS`, are unaffected + * + * `rate_limit_per_user` also applies to thread creation. Users can send one message and create one thread during each `rate_limit_per_user` interval. + * + * For thread channels, `rate_limit_per_user` is only returned if the field is set to a non-zero and non-null value. + * The absence of this field in API calls and Gateway events should indicate that slowmode has been reset to the default value. + */ + rate_limit_per_user?: number; } export interface APIGuildChannel extends APIChannelBase { @@ -111,23 +121,11 @@ export interface APIGuildTextChannel last_pin_timestamp?: string | null; } -export interface APITextChannel extends APIGuildTextChannel { - /** - * Amount of seconds a user has to wait before sending another message (0-21600); - * bots, as well as users with the permission `MANAGE_MESSAGES` or `MANAGE_CHANNELS`, are unaffected - * - * `rate_limit_per_user` also applies to thread creation. Users can send one message and create one thread during each `rate_limit_per_user` interval. - * - * For thread channels, `rate_limit_per_user` is only returned if the field is set to a non-zero and non-null value. - * The absence of this field in API calls and Gateway events should indicate that slowmode has been reset to the default value. - */ - rate_limit_per_user?: number; -} - +export type APITextChannel = APIGuildTextChannel; export type APINewsChannel = APIGuildTextChannel; export type APIGuildCategoryChannel = APIGuildChannel; -export interface APIVoiceChannel extends APIGuildChannel { +export interface APIVoiceChannelBase extends APIGuildChannel { /** * The bitrate (in bits) of the voice channel */ @@ -142,6 +140,11 @@ export interface APIVoiceChannel extends APIGuildChannel, + APITextBasedChannel { /** * The camera video quality mode of the voice channel, `1` when not present * @@ -150,7 +153,9 @@ export interface APIVoiceChannel extends APIGuildChannel extends APITextBasedChannel { +export type APIGuildStageVoiceChannel = APIVoiceChannelBase; + +export interface APIDMChannelBase extends Omit, 'rate_limit_per_user'> { /** * The recipients of the DM * @@ -242,7 +247,8 @@ export type APIChannel = | APIDMChannel | APITextChannel | APINewsChannel - | APIVoiceChannel + | APIGuildVoiceChannel + | APIGuildStageVoiceChannel | APIGuildCategoryChannel | APIThreadChannel | APINewsChannel