From 493e4f9350a53f005416ce3d1552d3e776e42854 Mon Sep 17 00:00:00 2001 From: Suneet Tipirneni <77477100+suneettipirneni@users.noreply.github.com> Date: Wed, 17 Nov 2021 16:47:50 -0500 Subject: [PATCH] feat(ThreadManager): add slowmode option on thread creation (#6989) Co-authored-by: SpaceEEC --- src/managers/ThreadManager.js | 3 +++ src/structures/Message.js | 1 + typings/index.d.ts | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/managers/ThreadManager.js b/src/managers/ThreadManager.js index 300041d0868e..9cd4f049e2c5 100644 --- a/src/managers/ThreadManager.js +++ b/src/managers/ThreadManager.js @@ -69,6 +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 rate limit per user (slowmode) for the new channel in seconds */ /** @@ -104,6 +105,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 +135,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/src/structures/Message.js b/src/structures/Message.js index 46036f65dad2..31d65be2e3e9 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 a4e323c70ab1..ec589cd1193f 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -5058,6 +5058,7 @@ export interface StartThreadOptions { name: string; autoArchiveDuration?: ThreadAutoArchiveDuration; reason?: string; + rateLimitPerUser?: number; } export type Status = number; @@ -5115,6 +5116,7 @@ export interface ThreadCreateOptions extends StartThreadOptio startMessage?: MessageResolvable; type?: AllowedThreadType; invitable?: AllowedThreadType extends 'GUILD_PRIVATE_THREAD' | 12 ? boolean : never; + rateLimitPerUser?: number; } export interface ThreadEditData {