Skip to content

Commit fd601e8

Browse files
Soheabdolfies
authored andcommitted
Add ability to create a media-only forum channel
1 parent f88ca3a commit fd601e8

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

discord/guild.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2044,6 +2044,7 @@ async def create_forum(
20442044
category: Optional[CategoryChannel] = None,
20452045
slowmode_delay: int = MISSING,
20462046
nsfw: bool = MISSING,
2047+
media: bool = MISSING,
20472048
overwrites: Mapping[Union[Role, Member, Object], PermissionOverwrite] = MISSING,
20482049
reason: Optional[str] = None,
20492050
default_auto_archive_duration: int = MISSING,
@@ -2100,8 +2101,13 @@ async def create_forum(
21002101
add reaction button.
21012102
default_layout: :class:`ForumLayoutType`
21022103
The default layout for posts in this forum.
2104+
This cannot be set if ``media`` is set to ``True``.
21032105
available_tags: Sequence[:class:`ForumTag`]
21042106
The available tags for this forum channel.
2107+
media: :class:`bool`
2108+
Whether to create a media forum channel.
2109+
2110+
.. versionadded:: 2.1
21052111
21062112
Raises
21072113
-------
@@ -2153,7 +2159,7 @@ async def create_forum(
21532159
else:
21542160
raise ValueError(f'default_reaction_emoji parameter must be either Emoji, PartialEmoji, or str')
21552161

2156-
if default_layout is not MISSING:
2162+
if not media and default_layout is not MISSING:
21572163
if not isinstance(default_layout, ForumLayoutType):
21582164
raise TypeError(
21592165
f'default_layout parameter must be a ForumLayoutType not {default_layout.__class__.__name__}'
@@ -2167,13 +2173,15 @@ async def create_forum(
21672173
data = await self._create_channel(
21682174
name=name,
21692175
overwrites=overwrites,
2170-
channel_type=ChannelType.forum,
2176+
channel_type=ChannelType.forum if not media else ChannelType.media,
21712177
category=category,
21722178
reason=reason,
21732179
**options,
21742180
)
21752181

2176-
channel = ForumChannel(state=self._state, guild=self, data=data)
2182+
channel = ForumChannel(
2183+
state=self._state, guild=self, data=data # pyright: ignore[reportArgumentType] # it's the correct data
2184+
)
21772185

21782186
# temporarily add to the cache
21792187
self._channels[channel.id] = channel

0 commit comments

Comments
 (0)