Skip to content

Commit

Permalink
feat: add forum sort order
Browse files Browse the repository at this point in the history
  • Loading branch information
LordOfPolls committed Jul 15, 2023
1 parent c5c5045 commit b4e289e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions interactions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@
ExponentialBackoffSystem,
LeakyBucketSystem,
TokenBucketSystem,
ForumSortOrder,
)
from .api import events
from . import ext
Expand Down Expand Up @@ -458,6 +459,7 @@
"File",
"FlatUIColors",
"FlatUIColours",
"ForumSortOrder",
"ForumLayoutType",
"get_components_ids",
"get_logger",
Expand Down
2 changes: 2 additions & 0 deletions interactions/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
WebhookMixin,
WebhookTypes,
WebSocketOPCode,
ForumSortOrder,
)
from .internal import (
ActiveVoiceState,
Expand Down Expand Up @@ -396,6 +397,7 @@
"File",
"FlatUIColors",
"FlatUIColours",
"ForumSortOrder",
"ForumLayoutType",
"get_components_ids",
"global_autocomplete",
Expand Down
2 changes: 2 additions & 0 deletions interactions/models/discord/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
VerificationLevel,
VideoQualityMode,
WebSocketOPCode,
ForumSortOrder,
)
from .file import File, open_file, UPLOADABLE_TYPE
from .guild import (
Expand Down Expand Up @@ -226,6 +227,7 @@
"File",
"FlatUIColors",
"FlatUIColours",
"ForumSortOrder",
"ForumLayoutType",
"get_components_ids",
"Guild",
Expand Down
8 changes: 8 additions & 0 deletions interactions/models/discord/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"DefaultNotificationLevel",
"ExplicitContentFilterLevel",
"ForumLayoutType",
"ForumSortOrder",
"IntegrationExpireBehaviour",
"Intents",
"InteractionPermissionTypes",
Expand Down Expand Up @@ -1046,3 +1047,10 @@ class ForumLayoutType(CursedIntEnum):
NOT_SET = 0
LIST = 1
GALLERY = 2


class ForumSortOrder(CursedIntEnum):
"""The order of a forum channel."""

LATEST_ACTIVITY = 0
CREATION_DATE = 1
4 changes: 4 additions & 0 deletions interactions/models/discord/guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
ScheduledEventType,
SystemChannelFlags,
VerificationLevel,
ForumSortOrder,
)
from .snowflake import (
Snowflake_Type,
Expand Down Expand Up @@ -1023,6 +1024,7 @@ async def create_forum_channel(
default_reaction_emoji: Absent[Union[dict, "models.PartialEmoji", "models.DefaultReaction", str]] = MISSING,
available_tags: Absent["list[dict | models.ThreadTag] | dict | models.ThreadTag"] = MISSING,
layout: ForumLayoutType = ForumLayoutType.NOT_SET,
sort_order: Absent[ForumSortOrder] = MISSING,
reason: Absent[Optional[str]] = MISSING,
) -> "models.GuildForum":
"""
Expand All @@ -1039,6 +1041,7 @@ async def create_forum_channel(
default_reaction_emoji: The default emoji to react with when creating a thread
available_tags: The available tags for this forum channel
layout: The layout of the forum channel
sort_order: The sort order of the forum channel
reason: The reason for creating this channel
Returns:
Expand All @@ -1057,6 +1060,7 @@ async def create_forum_channel(
default_reaction_emoji=models.process_default_reaction(default_reaction_emoji),
available_tags=list_converter(models.process_thread_tag)(available_tags) if available_tags else MISSING,
default_forum_layout=layout,
default_sort_order=sort_order,
reason=reason,
)

Expand Down

0 comments on commit b4e289e

Please sign in to comment.