feat(ThreadManager): add slowmode option on thread creation (#6989)

Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
This commit is contained in:
Suneet Tipirneni
2021-11-17 16:47:50 -05:00
committed by GitHub
parent c0ba2d46d0
commit 493e4f9350
3 changed files with 6 additions and 0 deletions

View File

@@ -69,6 +69,7 @@ class ThreadManager extends CachedManager {
* `GUILD_NEWS_THREAD`</warn>
* @property {boolean} [invitable] Whether non-moderators can add other non-moderators to the thread
* <info>Can only be set when type will be `GUILD_PRIVATE_THREAD`</info>
* @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,
});