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: support default_thread_rate_limit_per_user in channel creation #9339

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/managers/GuildChannelManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ class GuildChannelManager extends CachedManager {
defaultReactionEmoji,
defaultSortOrder,
defaultForumLayout,
defaultThreadRateLimitPerUser,
reason,
} = {},
) {
Expand Down Expand Up @@ -191,6 +192,7 @@ class GuildChannelManager extends CachedManager {
default_reaction_emoji: defaultReactionEmoji && transformGuildDefaultReaction(defaultReactionEmoji),
default_sort_order: sortMode,
default_forum_layout: layoutMode,
default_thread_rate_limit_per_user: defaultThreadRateLimitPerUser,
},
reason,
});
Expand Down
10 changes: 10 additions & 0 deletions src/structures/BaseGuildTextChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 2 additions & 0 deletions src/structures/CategoryChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class CategoryChannel extends GuildChannel {
* @property {?DefaultReactionEmoji} [defaultReactionEmoji] The emoji to set as the default reaction emoji
* @property {number} [defaultThreadRateLimitPerUser] The rate limit per user (slowmode) to set on forum posts
* @property {?SortOrderType} [defaultSortOrder] The default sort order mode to set on the new channel
* @property {number} [defaultThreadRateLimitPerUser] The initial rate limit per user (slowmode)
* to set on newly created threads in a channel.
* @property {string} [reason] Reason for creating the new channel
*/

Expand Down
2 changes: 2 additions & 0 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ export class BaseGuildEmoji extends Emoji {
export class BaseGuildTextChannel extends TextBasedChannelMixin(GuildChannel) {
protected constructor(guild: Guild, data?: RawGuildChannelData, client?: Client, immediatePatch?: boolean);
public defaultAutoArchiveDuration?: ThreadAutoArchiveDuration;
public defaultThreadRateLimitPerUser: number | null;
public rateLimitPerUser: number | null;
public nsfw: boolean;
public threads: GuildTextThreadManager<AllowedThreadTypeForTextChannel | AllowedThreadTypeForNewsChannel>;
Expand Down Expand Up @@ -4488,6 +4489,7 @@ export interface CategoryCreateChannelOptions {
defaultReactionEmoji?: DefaultReactionEmoji;
defaultSortOrder?: SortOrderType;
defaultForumLayout?: ForumLayoutType;
defaultThreadRateLimitPerUser?: number;
reason?: string;
}

Expand Down
Loading