mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 03:53:29 +01:00
feat(ForumChannel): add defaultForumLayout (#8895)
* feat(ForumChannel): add `defaultForumLayout` * fix: lockfile
This commit is contained in:
@@ -56,6 +56,7 @@ class CategoryChannelChildManager extends DataManager {
|
||||
* @property {ThreadAutoArchiveDuration} [defaultAutoArchiveDuration]
|
||||
* The default auto archive duration for all new threads in this channel
|
||||
* @property {SortOrderType} [defaultSortOrder] The default sort order mode used to order posts (forum only).
|
||||
* @property {ForumLayoutType} [defaultForumLayout] The default layout used to display posts (forum only).
|
||||
* @property {string} [reason] Reason for creating the new channel
|
||||
*/
|
||||
|
||||
|
||||
@@ -161,6 +161,7 @@ class GuildChannelManager extends CachedManager {
|
||||
defaultReactionEmoji,
|
||||
defaultAutoArchiveDuration,
|
||||
defaultSortOrder,
|
||||
defaultForumLayout,
|
||||
reason,
|
||||
}) {
|
||||
parent &&= this.client.channels.resolveId(parent);
|
||||
@@ -184,6 +185,7 @@ class GuildChannelManager extends CachedManager {
|
||||
default_reaction_emoji: defaultReactionEmoji && transformGuildDefaultReaction(defaultReactionEmoji),
|
||||
default_auto_archive_duration: defaultAutoArchiveDuration,
|
||||
default_sort_order: defaultSortOrder,
|
||||
default_forum_layout: defaultForumLayout,
|
||||
},
|
||||
reason,
|
||||
});
|
||||
@@ -252,6 +254,7 @@ class GuildChannelManager extends CachedManager {
|
||||
* @property {number} [defaultThreadRateLimitPerUser] The rate limit per user (slowmode) to set on forum posts
|
||||
* @property {ChannelFlagsResolvable} [flags] The flags to set on the channel
|
||||
* @property {?SortOrderType} [defaultSortOrder] The default sort order mode to set on the channel
|
||||
* @property {ForumLayoutType} [defaultForumLayout] The default forum layout to set on the channel
|
||||
* @property {string} [reason] Reason for editing this channel
|
||||
*/
|
||||
|
||||
@@ -314,6 +317,7 @@ class GuildChannelManager extends CachedManager {
|
||||
default_thread_rate_limit_per_user: options.defaultThreadRateLimitPerUser,
|
||||
flags: 'flags' in options ? ChannelFlagsBitField.resolve(options.flags) : undefined,
|
||||
default_sort_order: options.defaultSortOrder,
|
||||
default_forum_layout: options.defaultForumLayout,
|
||||
},
|
||||
reason: options.reason,
|
||||
});
|
||||
|
||||
@@ -134,6 +134,12 @@ class ForumChannel extends GuildChannel {
|
||||
} else {
|
||||
this.defaultSortOrder ??= null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The default layout type used to display posts
|
||||
* @type {ForumLayoutType}
|
||||
*/
|
||||
this.defaultForumLayout = data.default_forum_layout;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -225,6 +231,16 @@ class ForumChannel extends GuildChannel {
|
||||
return this.edit({ defaultSortOrder, reason });
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default forum layout type used to display posts
|
||||
* @param {ForumLayoutType} defaultForumLayout The default forum layout type to set on this channel
|
||||
* @param {string} [reason] Reason for changing the default forum layout
|
||||
* @returns {Promise<ForumChannel>}
|
||||
*/
|
||||
setDefaultForumLayout(defaultForumLayout, reason) {
|
||||
return this.edit({ defaultForumLayout, reason });
|
||||
}
|
||||
|
||||
// These are here only for documentation purposes - they are implemented by TextBasedChannel
|
||||
/* eslint-disable no-empty-function */
|
||||
createWebhook() {}
|
||||
|
||||
@@ -218,6 +218,11 @@
|
||||
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/ComponentType}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @external ForumLayoutType
|
||||
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/ForumLayoutType}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @external GatewayCloseCodes
|
||||
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/GatewayCloseCodes}
|
||||
|
||||
Reference in New Issue
Block a user