Skip to content

Commit

Permalink
Update guild channel API method overloads
Browse files Browse the repository at this point in the history
  • Loading branch information
4Kaylum committed Jun 21, 2023
1 parent d9a63bd commit c04f04e
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions novus/models/api_mixins/guild/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async def fetch_channels(self: StateSnowflake) -> list[Channel]:

channels = await self.state.guild.get_guild_channels(self.id)
for c in channels:
c.guild = self
c.guild = self # pyright: ignore
return channels

@overload
Expand All @@ -61,16 +61,12 @@ async def create_channel(
*,
name: str,
type: ChannelType = ChannelType.guild_text,
bitrate: int = ...,
user_limit: int = ...,
rate_limit_per_user: int = ...,
topic: str = ...,
position: int = ...,
permission_overwrites: list[PermissionOverwrite] = ...,
parent: int | Snowflake = ...,
nsfw: bool = ...,
default_auto_archive_duration: int = ...,
default_reaction_emoji: Reaction = ...,
available_tags: list[ForumTag] = ...) -> GuildTextChannel:
reason: str = ...) -> GuildTextChannel:
...

@overload
Expand All @@ -79,16 +75,12 @@ async def create_channel(
*,
name: str,
type: ChannelType = ChannelType.private_thread,
bitrate: int = ...,
user_limit: int = ...,
rate_limit_per_user: int = ...,
position: int = ...,
permission_overwrites: list[PermissionOverwrite] = ...,
parent: int | Snowflake = ...,
nsfw: bool = ...,
default_auto_archive_duration: int = ...,
default_reaction_emoji: Reaction = ...,
available_tags: list[ForumTag] = ...) -> Thread:
reason: str = ...) -> Thread:
...

@overload
Expand All @@ -97,23 +89,20 @@ async def create_channel(
*,
name: str,
type: ChannelType = ChannelType.public_thread,
bitrate: int = ...,
user_limit: int = ...,
rate_limit_per_user: int = ...,
position: int = ...,
permission_overwrites: list[PermissionOverwrite] = ...,
parent: int | Snowflake = ...,
nsfw: bool = ...,
default_auto_archive_duration: int = ...,
default_reaction_emoji: Reaction = ...,
available_tags: list[ForumTag] = ...) -> Thread:
reason: str = ...) -> Thread:
...

async def create_channel(
self: StateSnowflake,
*,
name: str,
type: ChannelType = MISSING,
topic: str = MISSING,
bitrate: int = MISSING,
user_limit: int = MISSING,
rate_limit_per_user: int = MISSING,
Expand All @@ -123,7 +112,8 @@ async def create_channel(
nsfw: bool = MISSING,
default_auto_archive_duration: int = MISSING,
default_reaction_emoji: Reaction = MISSING,
available_tags: list[ForumTag] = MISSING) -> Channel:
available_tags: list[ForumTag] = MISSING,
reason: str = MISSING) -> Channel:
"""
Create a channel within the guild.
Expand Down Expand Up @@ -156,6 +146,8 @@ async def create_channel(
use with forum channels.
available_tags : list[ForumTag]
The tags available for threads. Only for use with forum channels.
reason : str
The reason to be shown in the audit log.
Returns
-------
Expand All @@ -169,6 +161,8 @@ async def create_channel(
update["name"] = name
if type is not MISSING:
update["type"] = type
if topic is not MISSING:
update["topic"] = topic
if bitrate is not MISSING:
update["bitrate"] = bitrate
if user_limit is not MISSING:
Expand All @@ -190,8 +184,8 @@ async def create_channel(
if available_tags is not MISSING:
update["available_tags"] = available_tags

channel = await self.state.guild.create_guild_channel(self.id, **update)
channel.guild = self
channel = await self.state.guild.create_guild_channel(self.id, **update, reason=reason)
channel.guild = self # pyright: ignore
return channel

async def move_channels(self: StateSnowflake) -> None:
Expand Down

0 comments on commit c04f04e

Please sign in to comment.