mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 20:43:30 +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 {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 {string} [rtcRegion] The specific region of the new channel.
|
||||||
* @property {VideoQualityMode} [videoQualityMode] The camera video quality mode of the voice 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 {GuildForumTagData[]} [availableTags] The tags that can be used in this channel (forum only).
|
||||||
* @property {DefaultReactionEmoji} [defaultReactionEmoji]
|
* @property {DefaultReactionEmoji} [defaultReactionEmoji]
|
||||||
* The emoji to show in the add reaction button on a thread in a guild forum channel.
|
* 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,
|
rateLimitPerUser,
|
||||||
rtcRegion,
|
rtcRegion,
|
||||||
videoQualityMode,
|
videoQualityMode,
|
||||||
|
defaultThreadRateLimitPerUser,
|
||||||
availableTags,
|
availableTags,
|
||||||
defaultReactionEmoji,
|
defaultReactionEmoji,
|
||||||
defaultAutoArchiveDuration,
|
defaultAutoArchiveDuration,
|
||||||
@@ -181,6 +182,7 @@ class GuildChannelManager extends CachedManager {
|
|||||||
rate_limit_per_user: rateLimitPerUser,
|
rate_limit_per_user: rateLimitPerUser,
|
||||||
rtc_region: rtcRegion,
|
rtc_region: rtcRegion,
|
||||||
video_quality_mode: videoQualityMode,
|
video_quality_mode: videoQualityMode,
|
||||||
|
default_thread_rate_limit_per_user: defaultThreadRateLimitPerUser,
|
||||||
available_tags: availableTags?.map(availableTag => transformGuildForumTag(availableTag)),
|
available_tags: availableTags?.map(availableTag => transformGuildForumTag(availableTag)),
|
||||||
default_reaction_emoji: defaultReactionEmoji && transformGuildDefaultReaction(defaultReactionEmoji),
|
default_reaction_emoji: defaultReactionEmoji && transformGuildDefaultReaction(defaultReactionEmoji),
|
||||||
default_auto_archive_duration: defaultAutoArchiveDuration,
|
default_auto_archive_duration: defaultAutoArchiveDuration,
|
||||||
|
|||||||
@@ -74,6 +74,16 @@ class BaseGuildTextChannel extends GuildChannel {
|
|||||||
this.defaultAutoArchiveDuration = data.default_auto_archive_duration;
|
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) {
|
if ('messages' in data) {
|
||||||
for (const message of data.messages) this.messages._add(message);
|
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) {
|
export class BaseGuildTextChannel extends TextBasedChannelMixin(GuildChannel, true) {
|
||||||
protected constructor(guild: Guild, data?: RawGuildChannelData, client?: Client<true>, immediatePatch?: boolean);
|
protected constructor(guild: Guild, data?: RawGuildChannelData, client?: Client<true>, immediatePatch?: boolean);
|
||||||
public defaultAutoArchiveDuration?: ThreadAutoArchiveDuration;
|
public defaultAutoArchiveDuration?: ThreadAutoArchiveDuration;
|
||||||
|
public defaultThreadRateLimitPerUser: number | null;
|
||||||
public rateLimitPerUser: number | null;
|
public rateLimitPerUser: number | null;
|
||||||
public nsfw: boolean;
|
public nsfw: boolean;
|
||||||
public threads: GuildTextThreadManager<AllowedThreadTypeForTextChannel | AllowedThreadTypeForNewsChannel>;
|
public threads: GuildTextThreadManager<AllowedThreadTypeForTextChannel | AllowedThreadTypeForNewsChannel>;
|
||||||
@@ -4823,6 +4824,7 @@ export interface CategoryCreateChannelOptions {
|
|||||||
position?: number;
|
position?: number;
|
||||||
rtcRegion?: string;
|
rtcRegion?: string;
|
||||||
videoQualityMode?: VideoQualityMode;
|
videoQualityMode?: VideoQualityMode;
|
||||||
|
defaultThreadRateLimitPerUser?: number;
|
||||||
availableTags?: GuildForumTagData[];
|
availableTags?: GuildForumTagData[];
|
||||||
defaultReactionEmoji?: DefaultReactionEmoji;
|
defaultReactionEmoji?: DefaultReactionEmoji;
|
||||||
defaultAutoArchiveDuration?: ThreadAutoArchiveDuration;
|
defaultAutoArchiveDuration?: ThreadAutoArchiveDuration;
|
||||||
|
|||||||
Reference in New Issue
Block a user