From d2b62761194064b38e38045a72ee8b38c920ada6 Mon Sep 17 00:00:00 2001 From: ckohen Date: Tue, 15 Jun 2021 05:36:39 -0700 Subject: [PATCH] feat(Threads): add default auto archive and minor tweaks (#142) --- deno/payloads/v9/channel.ts | 8 ++++---- deno/rest/common.ts | 7 +++++++ deno/rest/v9/channel.ts | 6 ++++++ payloads/v9/channel.ts | 8 ++++---- rest/common.ts | 7 +++++++ rest/v9/channel.ts | 6 ++++++ 6 files changed, 34 insertions(+), 8 deletions(-) diff --git a/deno/payloads/v9/channel.ts b/deno/payloads/v9/channel.ts index 184abdfb..b869f285 100644 --- a/deno/payloads/v9/channel.ts +++ b/deno/payloads/v9/channel.ts @@ -132,6 +132,10 @@ export interface APIChannel extends APIPartialChannel { * The client users member for the thread, only included in select endpoints */ member?: APIThreadMember; + /** + * Default duration for newly created threads, in minutes, to automatically archive the thread after recent activity + */ + default_auto_archive_duration?: ThreadAutoArchiveDuration; } /** @@ -616,10 +620,6 @@ export interface APIThreadMetadata { * Whether the thread is archived */ archived: boolean; - /** - * ID of the user that last archived or unarchived the thread - */ - archiver_id?: Snowflake; /** * Duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080 */ diff --git a/deno/rest/common.ts b/deno/rest/common.ts index 7a085fe7..a2af6bde 100644 --- a/deno/rest/common.ts +++ b/deno/rest/common.ts @@ -59,6 +59,8 @@ export enum RESTJSONErrorCodes { GuildAlreadyHasTemplate = 30031, + MaximumThreadParticipants = 30033, + Unauthorized = 40001, VerifyYourAccount, @@ -114,4 +116,9 @@ export enum RESTJSONErrorCodes { ReactionWasBlocked = 90001, APIResourceOverloaded = 130000, + + ThreadAlreadyCreatedForMessage = 160004, + ThreadLocked, + MaximumActiveThreads, + MaximumActiveAnnoucementThreads, } diff --git a/deno/rest/v9/channel.ts b/deno/rest/v9/channel.ts index 838ba5df..9a6963d2 100644 --- a/deno/rest/v9/channel.ts +++ b/deno/rest/v9/channel.ts @@ -122,6 +122,12 @@ export interface RESTPatchAPIChannelJSONBody { * Channel types: newsThread, publicThread, privateThread */ locked?: boolean; + /** + * Default duration for newly created threads, in minutes, to automatically archive the thread after recent activity + * + * Channel types: text, news + */ + default_auto_archive_duration?: ThreadAutoArchiveDuration; } /** diff --git a/payloads/v9/channel.ts b/payloads/v9/channel.ts index 696496f2..13b39de4 100644 --- a/payloads/v9/channel.ts +++ b/payloads/v9/channel.ts @@ -132,6 +132,10 @@ export interface APIChannel extends APIPartialChannel { * The client users member for the thread, only included in select endpoints */ member?: APIThreadMember; + /** + * Default duration for newly created threads, in minutes, to automatically archive the thread after recent activity + */ + default_auto_archive_duration?: ThreadAutoArchiveDuration; } /** @@ -616,10 +620,6 @@ export interface APIThreadMetadata { * Whether the thread is archived */ archived: boolean; - /** - * ID of the user that last archived or unarchived the thread - */ - archiver_id?: Snowflake; /** * Duration in minutes to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080 */ diff --git a/rest/common.ts b/rest/common.ts index 63955d8e..90d0d11d 100644 --- a/rest/common.ts +++ b/rest/common.ts @@ -59,6 +59,8 @@ export const enum RESTJSONErrorCodes { GuildAlreadyHasTemplate = 30031, + MaximumThreadParticipants = 30033, + Unauthorized = 40001, VerifyYourAccount, @@ -114,4 +116,9 @@ export const enum RESTJSONErrorCodes { ReactionWasBlocked = 90001, APIResourceOverloaded = 130000, + + ThreadAlreadyCreatedForMessage = 160004, + ThreadLocked, + MaximumActiveThreads, + MaximumActiveAnnoucementThreads, } diff --git a/rest/v9/channel.ts b/rest/v9/channel.ts index 702bf3df..b67d19e5 100644 --- a/rest/v9/channel.ts +++ b/rest/v9/channel.ts @@ -122,6 +122,12 @@ export interface RESTPatchAPIChannelJSONBody { * Channel types: newsThread, publicThread, privateThread */ locked?: boolean; + /** + * Default duration for newly created threads, in minutes, to automatically archive the thread after recent activity + * + * Channel types: text, news + */ + default_auto_archive_duration?: ThreadAutoArchiveDuration; } /**