mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 04:53:30 +01:00
feat(ThreadManager): add slowmode option on thread creation (#6989)
Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
This commit is contained in:
@@ -69,6 +69,7 @@ class ThreadManager extends CachedManager {
|
|||||||
* `GUILD_NEWS_THREAD`</warn>
|
* `GUILD_NEWS_THREAD`</warn>
|
||||||
* @property {boolean} [invitable] Whether non-moderators can add other non-moderators to the thread
|
* @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>
|
* <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,
|
type,
|
||||||
invitable,
|
invitable,
|
||||||
reason,
|
reason,
|
||||||
|
rateLimitPerUser,
|
||||||
} = {}) {
|
} = {}) {
|
||||||
let path = this.client.api.channels(this.channel.id);
|
let path = this.client.api.channels(this.channel.id);
|
||||||
if (type && typeof type !== 'string' && typeof type !== 'number') {
|
if (type && typeof type !== 'string' && typeof type !== 'number') {
|
||||||
@@ -133,6 +135,7 @@ class ThreadManager extends CachedManager {
|
|||||||
auto_archive_duration: autoArchiveDuration,
|
auto_archive_duration: autoArchiveDuration,
|
||||||
type: resolvedType,
|
type: resolvedType,
|
||||||
invitable: resolvedType === ChannelTypes.GUILD_PRIVATE_THREAD ? invitable : undefined,
|
invitable: resolvedType === ChannelTypes.GUILD_PRIVATE_THREAD ? invitable : undefined,
|
||||||
|
rate_limit_per_user: rateLimitPerUser,
|
||||||
},
|
},
|
||||||
reason,
|
reason,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -797,6 +797,7 @@ class Message extends Base {
|
|||||||
* @property {ThreadAutoArchiveDuration} [autoArchiveDuration=this.channel.defaultAutoArchiveDuration] The amount of
|
* @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
|
* 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 {string} [reason] Reason for creating the thread
|
||||||
|
* @property {number} [rateLimitPerUser] The rate limit per user (slowmode) for the thread in seconds
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
2
typings/index.d.ts
vendored
2
typings/index.d.ts
vendored
@@ -5058,6 +5058,7 @@ export interface StartThreadOptions {
|
|||||||
name: string;
|
name: string;
|
||||||
autoArchiveDuration?: ThreadAutoArchiveDuration;
|
autoArchiveDuration?: ThreadAutoArchiveDuration;
|
||||||
reason?: string;
|
reason?: string;
|
||||||
|
rateLimitPerUser?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Status = number;
|
export type Status = number;
|
||||||
@@ -5115,6 +5116,7 @@ export interface ThreadCreateOptions<AllowedThreadType> extends StartThreadOptio
|
|||||||
startMessage?: MessageResolvable;
|
startMessage?: MessageResolvable;
|
||||||
type?: AllowedThreadType;
|
type?: AllowedThreadType;
|
||||||
invitable?: AllowedThreadType extends 'GUILD_PRIVATE_THREAD' | 12 ? boolean : never;
|
invitable?: AllowedThreadType extends 'GUILD_PRIVATE_THREAD' | 12 ? boolean : never;
|
||||||
|
rateLimitPerUser?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ThreadEditData {
|
export interface ThreadEditData {
|
||||||
|
|||||||
Reference in New Issue
Block a user