mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
feat: Support default_thread_rate_limit_per_user in channel creation (#9273)
feat: support `default_thread_rate_limit_per_user` in channel creation
This commit is contained in:
@@ -50,6 +50,8 @@ class CategoryChannelChildManager extends DataManager {
|
||||
* @property {number} [rateLimitPerUser] The rate limit per user (slowmode) for the new channel in seconds
|
||||
* @property {string} [rtcRegion] The specific region of the new channel.
|
||||
* @property {VideoQualityMode} [videoQualityMode] The camera video quality mode of the voice channel
|
||||
* @property {number} [defaultThreadRateLimitPerUser] The initial rate limit per user (slowmode)
|
||||
* to set on newly created threads in a channel.
|
||||
* @property {GuildForumTagData[]} [availableTags] The tags that can be used in this channel (forum only).
|
||||
* @property {DefaultReactionEmoji} [defaultReactionEmoji]
|
||||
* The emoji to show in the add reaction button on a thread in a guild forum channel.
|
||||
|
||||
@@ -157,6 +157,7 @@ class GuildChannelManager extends CachedManager {
|
||||
rateLimitPerUser,
|
||||
rtcRegion,
|
||||
videoQualityMode,
|
||||
defaultThreadRateLimitPerUser,
|
||||
availableTags,
|
||||
defaultReactionEmoji,
|
||||
defaultAutoArchiveDuration,
|
||||
@@ -181,6 +182,7 @@ class GuildChannelManager extends CachedManager {
|
||||
rate_limit_per_user: rateLimitPerUser,
|
||||
rtc_region: rtcRegion,
|
||||
video_quality_mode: videoQualityMode,
|
||||
default_thread_rate_limit_per_user: defaultThreadRateLimitPerUser,
|
||||
available_tags: availableTags?.map(availableTag => transformGuildForumTag(availableTag)),
|
||||
default_reaction_emoji: defaultReactionEmoji && transformGuildDefaultReaction(defaultReactionEmoji),
|
||||
default_auto_archive_duration: defaultAutoArchiveDuration,
|
||||
|
||||
@@ -74,6 +74,16 @@ class BaseGuildTextChannel extends GuildChannel {
|
||||
this.defaultAutoArchiveDuration = data.default_auto_archive_duration;
|
||||
}
|
||||
|
||||
if ('default_thread_rate_limit_per_user' in data) {
|
||||
/**
|
||||
* The initial rate limit per user (slowmode) to set on newly created threads in a channel.
|
||||
* @type {?number}
|
||||
*/
|
||||
this.defaultThreadRateLimitPerUser = data.default_thread_rate_limit_per_user;
|
||||
} else {
|
||||
this.defaultThreadRateLimitPerUser ??= null;
|
||||
}
|
||||
|
||||
if ('messages' in data) {
|
||||
for (const message of data.messages) this.messages._add(message);
|
||||
}
|
||||
|
||||
2
packages/discord.js/typings/index.d.ts
vendored
2
packages/discord.js/typings/index.d.ts
vendored
@@ -636,6 +636,7 @@ export class BaseGuildEmoji extends Emoji {
|
||||
export class BaseGuildTextChannel extends TextBasedChannelMixin(GuildChannel, true) {
|
||||
protected constructor(guild: Guild, data?: RawGuildChannelData, client?: Client<true>, immediatePatch?: boolean);
|
||||
public defaultAutoArchiveDuration?: ThreadAutoArchiveDuration;
|
||||
public defaultThreadRateLimitPerUser: number | null;
|
||||
public rateLimitPerUser: number | null;
|
||||
public nsfw: boolean;
|
||||
public threads: GuildTextThreadManager<AllowedThreadTypeForTextChannel | AllowedThreadTypeForNewsChannel>;
|
||||
@@ -4823,6 +4824,7 @@ export interface CategoryCreateChannelOptions {
|
||||
position?: number;
|
||||
rtcRegion?: string;
|
||||
videoQualityMode?: VideoQualityMode;
|
||||
defaultThreadRateLimitPerUser?: number;
|
||||
availableTags?: GuildForumTagData[];
|
||||
defaultReactionEmoji?: DefaultReactionEmoji;
|
||||
defaultAutoArchiveDuration?: ThreadAutoArchiveDuration;
|
||||
|
||||
Reference in New Issue
Block a user