Skip to content

Commit

Permalink
fix(typing): support Object category in create_x_channel (#1163)
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftinv authored Mar 19, 2024
1 parent 17b741a commit 227ec80
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
14 changes: 7 additions & 7 deletions changelog/1050.feature.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- Add support for media channels.
- Add :class:`MediaChannel`.
- Unless otherwise noted, media channels behave just like forum channels.
- Add :attr:`ChannelType.media`.
- Add :attr:`CategoryChannel.media_channels`, :attr:`Guild.media_channels`.
- Add :attr:`CategoryChannel.create_media_channel`, :attr:`Guild.create_media_channel`.
- Add :attr:`ChannelFlags.hide_media_download_options`.
Add support for media channels.
- Add :class:`MediaChannel`.
- Unless otherwise noted, media channels behave just like forum channels.
- Add :attr:`ChannelType.media`.
- Add :attr:`CategoryChannel.media_channels`, :attr:`Guild.media_channels`.
- Add :attr:`CategoryChannel.create_media_channel`, :attr:`Guild.create_media_channel`.
- Add :attr:`ChannelFlags.hide_media_download_options`.
1 change: 1 addition & 0 deletions changelog/1162.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Adjust type annotations to allow :class:`Object` as ``category`` parameter in :meth:`Guild.create_text_channel` and similar methods.
20 changes: 10 additions & 10 deletions disnake/guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,7 @@ async def create_text_channel(
name: str,
*,
reason: Optional[str] = None,
category: Optional[CategoryChannel] = None,
category: Optional[Snowflake] = None,
position: int = MISSING,
topic: Optional[str] = MISSING,
slowmode_delay: int = MISSING,
Expand Down Expand Up @@ -1292,7 +1292,7 @@ async def create_text_channel(
A :class:`dict` of target (either a role or a member) to
:class:`PermissionOverwrite` to apply upon creation of a channel.
Useful for creating secret channels.
category: Optional[:class:`CategoryChannel`]
category: Optional[:class:`abc.Snowflake`]
The category to place the newly created channel under.
The permissions will be automatically synced to category if no
overwrites are provided.
Expand Down Expand Up @@ -1388,7 +1388,7 @@ async def create_voice_channel(
self,
name: str,
*,
category: Optional[CategoryChannel] = None,
category: Optional[Snowflake] = None,
position: int = MISSING,
bitrate: int = MISSING,
user_limit: int = MISSING,
Expand All @@ -1414,7 +1414,7 @@ async def create_voice_channel(
A :class:`dict` of target (either a role or a member) to
:class:`PermissionOverwrite` to apply upon creation of a channel.
Useful for creating secret channels.
category: Optional[:class:`CategoryChannel`]
category: Optional[:class:`abc.Snowflake`]
The category to place the newly created channel under.
The permissions will be automatically synced to category if no
overwrites are provided.
Expand Down Expand Up @@ -1512,7 +1512,7 @@ async def create_stage_channel(
rtc_region: Optional[Union[str, VoiceRegion]] = MISSING,
video_quality_mode: VideoQualityMode = MISSING,
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = MISSING,
category: Optional[CategoryChannel] = None,
category: Optional[Snowflake] = None,
nsfw: bool = MISSING,
slowmode_delay: int = MISSING,
reason: Optional[str] = None,
Expand Down Expand Up @@ -1540,7 +1540,7 @@ async def create_stage_channel(
A :class:`dict` of target (either a role or a member) to
:class:`PermissionOverwrite` to apply upon creation of a channel.
Useful for creating secret channels.
category: Optional[:class:`CategoryChannel`]
category: Optional[:class:`abc.Snowflake`]
The category to place the newly created channel under.
The permissions will be automatically synced to category if no
overwrites are provided.
Expand Down Expand Up @@ -1633,7 +1633,7 @@ async def create_forum_channel(
name: str,
*,
topic: Optional[str] = None,
category: Optional[CategoryChannel] = None,
category: Optional[Snowflake] = None,
position: int = MISSING,
slowmode_delay: int = MISSING,
default_thread_slowmode_delay: int = MISSING,
Expand Down Expand Up @@ -1661,7 +1661,7 @@ async def create_forum_channel(
The channel's name.
topic: Optional[:class:`str`]
The channel's topic.
category: Optional[:class:`CategoryChannel`]
category: Optional[:class:`abc.Snowflake`]
The category to place the newly created channel under.
The permissions will be automatically synced to category if no
overwrites are provided.
Expand Down Expand Up @@ -1783,7 +1783,7 @@ async def create_media_channel(
name: str,
*,
topic: Optional[str] = None,
category: Optional[CategoryChannel] = None,
category: Optional[Snowflake] = None,
position: int = MISSING,
slowmode_delay: int = MISSING,
default_thread_slowmode_delay: int = MISSING,
Expand All @@ -1807,7 +1807,7 @@ async def create_media_channel(
The channel's name.
topic: Optional[:class:`str`]
The channel's topic.
category: Optional[:class:`CategoryChannel`]
category: Optional[:class:`abc.Snowflake`]
The category to place the newly created channel under.
The permissions will be automatically synced to category if no
overwrites are provided.
Expand Down

0 comments on commit 227ec80

Please sign in to comment.