From c40f8dbb57edeba84667312b121051d1cd8752f6 Mon Sep 17 00:00:00 2001 From: suneettipirneni Date: Mon, 15 Nov 2021 13:45:58 -0500 Subject: [PATCH 1/4] feat(ThreadManager): add user rate limit option on creation' --- src/managers/ThreadManager.js | 4 ++++ typings/index.d.ts | 1 + 2 files changed, 5 insertions(+) diff --git a/src/managers/ThreadManager.js b/src/managers/ThreadManager.js index 300041d0868e..cfbc6febc0d7 100644 --- a/src/managers/ThreadManager.js +++ b/src/managers/ThreadManager.js @@ -69,6 +69,8 @@ class ThreadManager extends CachedManager { * `GUILD_NEWS_THREAD` * @property {boolean} [invitable] Whether non-moderators can add other non-moderators to the thread * Can only be set when type will be `GUILD_PRIVATE_THREAD` + * @property {number} [rateLimitPerUser] The amount of seconds a user has to wait before sending another + * message. This value can be any integer between 1-21600 */ /** @@ -104,6 +106,7 @@ class ThreadManager extends CachedManager { type, invitable, reason, + rateLimitPerUser, } = {}) { let path = this.client.api.channels(this.channel.id); if (type && typeof type !== 'string' && typeof type !== 'number') { @@ -133,6 +136,7 @@ class ThreadManager extends CachedManager { auto_archive_duration: autoArchiveDuration, type: resolvedType, invitable: resolvedType === ChannelTypes.GUILD_PRIVATE_THREAD ? invitable : undefined, + rate_limit_per_user: rateLimitPerUser, }, reason, }); diff --git a/typings/index.d.ts b/typings/index.d.ts index 7f3bfe00e5de..c3b7bb5b67d4 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -5091,6 +5091,7 @@ export interface ThreadCreateOptions extends StartThreadOptio startMessage?: MessageResolvable; type?: AllowedThreadType; invitable?: AllowedThreadType extends 'GUILD_PRIVATE_THREAD' | 12 ? boolean : never; + rateLimitPerUser?: number; } export interface ThreadEditData { From 4bce851e1c3e5ce353264a72a671f564287a6e06 Mon Sep 17 00:00:00 2001 From: suneettipirneni Date: Mon, 15 Nov 2021 14:14:04 -0500 Subject: [PATCH 2/4] docs: update description --- src/managers/ThreadManager.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/managers/ThreadManager.js b/src/managers/ThreadManager.js index cfbc6febc0d7..9cd4f049e2c5 100644 --- a/src/managers/ThreadManager.js +++ b/src/managers/ThreadManager.js @@ -69,8 +69,7 @@ class ThreadManager extends CachedManager { * `GUILD_NEWS_THREAD` * @property {boolean} [invitable] Whether non-moderators can add other non-moderators to the thread * Can only be set when type will be `GUILD_PRIVATE_THREAD` - * @property {number} [rateLimitPerUser] The amount of seconds a user has to wait before sending another - * message. This value can be any integer between 1-21600 + * @property {number} [rateLimitPerUser] The rate limit per user (slowmode) for the new channel in seconds */ /** From be961dad50bc161745c2eb48792ec91609a0bfc6 Mon Sep 17 00:00:00 2001 From: suneettipirneni Date: Mon, 15 Nov 2021 16:08:57 -0500 Subject: [PATCH 3/4] types: add prop to Message#startThread --- src/structures/Message.js | 1 + typings/index.d.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/structures/Message.js b/src/structures/Message.js index 46036f65dad2..7f32168b2b0b 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -797,6 +797,7 @@ class Message extends Base { * @property {ThreadAutoArchiveDuration} [autoArchiveDuration=this.channel.defaultAutoArchiveDuration] The amount of * time (in minutes) after which the thread should automatically archive in case of no recent activity * @property {string} [reason] Reason for creating the thread + * @property {number} rateLimitPerUser The rate limit per user (slowmode) for the thread in seconds */ /** diff --git a/typings/index.d.ts b/typings/index.d.ts index c3b7bb5b67d4..42980fdf2a08 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -5034,6 +5034,7 @@ export interface StartThreadOptions { name: string; autoArchiveDuration?: ThreadAutoArchiveDuration; reason?: string; + rateLimitPerUser?: number; } export type Status = number; From 9e559f98d37b464806c741e669cc33288927d4bf Mon Sep 17 00:00:00 2001 From: Suneet Tipirneni <77477100+suneettipirneni@users.noreply.github.com> Date: Tue, 16 Nov 2021 10:46:06 -0500 Subject: [PATCH 4/4] Update src/structures/Message.js Co-authored-by: SpaceEEC --- src/structures/Message.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index 7f32168b2b0b..31d65be2e3e9 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -797,7 +797,7 @@ class Message extends Base { * @property {ThreadAutoArchiveDuration} [autoArchiveDuration=this.channel.defaultAutoArchiveDuration] The amount of * time (in minutes) after which the thread should automatically archive in case of no recent activity * @property {string} [reason] Reason for creating the thread - * @property {number} rateLimitPerUser The rate limit per user (slowmode) for the thread in seconds + * @property {number} [rateLimitPerUser] The rate limit per user (slowmode) for the thread in seconds */ /**