|
|
@ -47,7 +47,7 @@ import datetime |
|
|
|
import discord.abc |
|
|
|
from .scheduled_event import ScheduledEvent |
|
|
|
from .permissions import PermissionOverwrite, Permissions |
|
|
|
from .enums import ChannelType, ForumLayoutType, PrivacyLevel, try_enum, VideoQualityMode, EntityType |
|
|
|
from .enums import ChannelType, ForumLayoutType, ForumOrderType, PrivacyLevel, try_enum, VideoQualityMode, EntityType |
|
|
|
from .mixins import Hashable |
|
|
|
from . import utils |
|
|
|
from .utils import MISSING |
|
|
@ -2154,6 +2154,10 @@ class ForumChannel(discord.abc.GuildChannel, Hashable): |
|
|
|
Defaults to :attr:`ForumLayoutType.not_set`. |
|
|
|
|
|
|
|
.. versionadded:: 2.2 |
|
|
|
default_sort_order: Optional[:class:`ForumOrderType`] |
|
|
|
The default sort order for posts in this forum channel. |
|
|
|
|
|
|
|
.. versionadded:: 2.3 |
|
|
|
""" |
|
|
|
|
|
|
|
__slots__ = ( |
|
|
@ -2173,6 +2177,7 @@ class ForumChannel(discord.abc.GuildChannel, Hashable): |
|
|
|
'default_thread_slowmode_delay', |
|
|
|
'default_reaction_emoji', |
|
|
|
'default_layout', |
|
|
|
'default_sort_order', |
|
|
|
'_available_tags', |
|
|
|
'_flags', |
|
|
|
) |
|
|
@ -2218,6 +2223,11 @@ class ForumChannel(discord.abc.GuildChannel, Hashable): |
|
|
|
name=default_reaction_emoji.get('emoji_name') or '', |
|
|
|
) |
|
|
|
|
|
|
|
self.default_sort_order: Optional[ForumOrderType] = None |
|
|
|
default_sort_order = data.get('default_sort_order') |
|
|
|
if default_sort_order is not None: |
|
|
|
self.default_sort_order = try_enum(ForumOrderType, default_sort_order) |
|
|
|
|
|
|
|
self._flags: int = data.get('flags', 0) |
|
|
|
self._fill_overwrites(data) |
|
|
|
|
|
|
@ -2344,6 +2354,7 @@ class ForumChannel(discord.abc.GuildChannel, Hashable): |
|
|
|
default_thread_slowmode_delay: int = ..., |
|
|
|
default_reaction_emoji: Optional[EmojiInputType] = ..., |
|
|
|
default_layout: ForumLayoutType = ..., |
|
|
|
default_sort_order: ForumOrderType = ..., |
|
|
|
require_tag: bool = ..., |
|
|
|
) -> ForumChannel: |
|
|
|
... |
|
|
@ -2402,6 +2413,10 @@ class ForumChannel(discord.abc.GuildChannel, Hashable): |
|
|
|
The new default layout for posts in this forum. |
|
|
|
|
|
|
|
.. versionadded:: 2.2 |
|
|
|
default_sort_order: Optional[:class:`ForumOrderType`] |
|
|
|
The new default sort order for posts in this forum. |
|
|
|
|
|
|
|
.. versionadded:: 2.3 |
|
|
|
require_tag: :class:`bool` |
|
|
|
Whether to require a tag for threads in this channel or not. |
|
|
|
|
|
|
@ -2464,6 +2479,21 @@ class ForumChannel(discord.abc.GuildChannel, Hashable): |
|
|
|
|
|
|
|
options['default_forum_layout'] = layout.value |
|
|
|
|
|
|
|
try: |
|
|
|
sort_order = options.pop('default_sort_order') |
|
|
|
except KeyError: |
|
|
|
pass |
|
|
|
else: |
|
|
|
if sort_order is None: |
|
|
|
options['default_sort_order'] = None |
|
|
|
else: |
|
|
|
if not isinstance(sort_order, ForumOrderType): |
|
|
|
raise TypeError( |
|
|
|
f'default_sort_order parameter must be a ForumOrderType not {sort_order.__class__.__name__}' |
|
|
|
) |
|
|
|
|
|
|
|
options['default_sort_order'] = sort_order.value |
|
|
|
|
|
|
|
payload = await self._edit(options, reason=reason) |
|
|
|
if payload is not None: |
|
|
|
# the payload will always be the proper channel payload |
|
|
|