Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/managers/ThreadManager.js
Expand Up @@ -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
*/

/**
Expand Down Expand Up @@ -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') {
Expand Down Expand Up @@ -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,
});
Expand Down
1 change: 1 addition & 0 deletions src/structures/Message.js
Expand Up @@ -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
suneettipirneni marked this conversation as resolved.
Show resolved Hide resolved
*/

/**
Expand Down
2 changes: 2 additions & 0 deletions typings/index.d.ts
Expand Up @@ -5034,6 +5034,7 @@ export interface StartThreadOptions {
name: string;
autoArchiveDuration?: ThreadAutoArchiveDuration;
reason?: string;
rateLimitPerUser?: number;
}

export type Status = number;
Expand Down Expand Up @@ -5091,6 +5092,7 @@ export interface ThreadCreateOptions<AllowedThreadType> extends StartThreadOptio
startMessage?: MessageResolvable;
type?: AllowedThreadType;
invitable?: AllowedThreadType extends 'GUILD_PRIVATE_THREAD' | 12 ? boolean : never;
rateLimitPerUser?: number;
}

export interface ThreadEditData {
Expand Down