From 02d0254e3b2d5af23bef17bb42687f7595cadf1f Mon Sep 17 00:00:00 2001 From: 18 <111544899+eightween@users.noreply.github.com> Date: Wed, 13 Mar 2024 17:43:29 -0400 Subject: [PATCH 1/2] feat: added forum/media channel create methods --- interactions/models/discord/channel.py | 78 ++++++++++++++++++++++++ interactions/models/discord/guild.py | 84 ++++++++++++++++++++++++++ 2 files changed, 162 insertions(+) diff --git a/interactions/models/discord/channel.py b/interactions/models/discord/channel.py index 6869413dd..441bbaae7 100644 --- a/interactions/models/discord/channel.py +++ b/interactions/models/discord/channel.py @@ -1599,6 +1599,84 @@ async def create_stage_channel( user_limit=user_limit, reason=reason, ) + + async def create_forum_channel( + self, + name: str, + topic: Absent[Optional[str]] = MISSING, + position: Absent[Optional[int]] = MISSING, + permission_overwrites: Absent[ + Union[dict, PermissionOverwrite, List[Union[dict, PermissionOverwrite]]] + ] = MISSING, + bitrate: int = 64000, + user_limit: int = 0, + reason: Absent[Optional[str]] = MISSING, + ) -> "GuildForum": + """ + Create a guild forum channel within this category. + + Args: + name: The name of the channel + topic: The topic of the channel + position: The position of the channel in the channel list + permission_overwrites: Permission overwrites to apply to the channel + bitrate: The bitrate of this channel, only for voice + user_limit: The max users that can be in this channel, only for voice + reason: The reason for creating this channel + + Returns: + The newly created forum channel. + + """ + return await self.create_channel( + channel_type=ChannelType.GUILD_FORUM, + name=name, + topic=topic, + position=position, + permission_overwrites=permission_overwrites, + bitrate=bitrate, + user_limit=user_limit, + reason=reason, + ) + + async def create_media_channel( + self, + name: str, + topic: Absent[Optional[str]] = MISSING, + position: Absent[Optional[int]] = MISSING, + permission_overwrites: Absent[ + Union[dict, PermissionOverwrite, List[Union[dict, PermissionOverwrite]]] + ] = MISSING, + bitrate: int = 64000, + user_limit: int = 0, + reason: Absent[Optional[str]] = MISSING, + ) -> "GuildMedia": + """ + Create a guild media channel within this category. + + Args: + name: The name of the channel + topic: The topic of the channel + position: The position of the channel in the channel list + permission_overwrites: Permission overwrites to apply to the channel + bitrate: The bitrate of this channel, only for voice + user_limit: The max users that can be in this channel, only for voice + reason: The reason for creating this channel + + Returns: + The newly created media channel. + + """ + return await self.create_channel( + channel_type=ChannelType.GUILD_MEDIA, + name=name, + topic=topic, + position=position, + permission_overwrites=permission_overwrites, + bitrate=bitrate, + user_limit=user_limit, + reason=reason, + ) @attrs.define(eq=False, order=False, hash=False, kw_only=True) diff --git a/interactions/models/discord/guild.py b/interactions/models/discord/guild.py index f70a38d25..b63bde80e 100644 --- a/interactions/models/discord/guild.py +++ b/interactions/models/discord/guild.py @@ -1203,6 +1203,90 @@ async def create_stage_channel( user_limit=user_limit, reason=reason, ) + + async def create_forum_channel( + self, + name: str, + topic: Absent[Optional[str]] = MISSING, + position: Absent[Optional[int]] = MISSING, + permission_overwrites: Absent[ + Union[dict, "models.PermissionOverwrite", List[Union[dict, "models.PermissionOverwrite"]]] + ] = MISSING, + category: Absent[Union[Snowflake_Type, "models.GuildCategory"]] = MISSING, + bitrate: int = 64000, + user_limit: int = 0, + reason: Absent[Optional[str]] = MISSING, + ) -> "models.GuildForum": + """ + Create a guild forum channel. + + Args: + name: The name of the channel + topic: The topic of the channel + position: The position of the channel in the channel list + permission_overwrites: Permission overwrites to apply to the channel + category: The category this channel should be within + bitrate: The bitrate of this channel, only for voice + user_limit: The max users that can be in this channel, only for voice + reason: The reason for creating this channel + + Returns: + The newly created forum channel. + + """ + return await self.create_channel( + channel_type=ChannelType.GUILD_FORUM, + name=name, + topic=topic, + position=position, + permission_overwrites=permission_overwrites, + category=category, + bitrate=bitrate, + user_limit=user_limit, + reason=reason, + ) + + async def create_media_channel( + self, + name: str, + topic: Absent[Optional[str]] = MISSING, + position: Absent[Optional[int]] = MISSING, + permission_overwrites: Absent[ + Union[dict, "models.PermissionOverwrite", List[Union[dict, "models.PermissionOverwrite"]]] + ] = MISSING, + category: Absent[Union[Snowflake_Type, "models.GuildCategory"]] = MISSING, + bitrate: int = 64000, + user_limit: int = 0, + reason: Absent[Optional[str]] = MISSING, + ) -> "models.GuildMedia": + """ + Create a guild media channel. + + Args: + name: The name of the channel + topic: The topic of the channel + position: The position of the channel in the channel list + permission_overwrites: Permission overwrites to apply to the channel + category: The category this channel should be within + bitrate: The bitrate of this channel, only for voice + user_limit: The max users that can be in this channel, only for voice + reason: The reason for creating this channel + + Returns: + The newly created media channel. + + """ + return await self.create_channel( + channel_type=ChannelType.GUILD_MEDIA, + name=name, + topic=topic, + position=position, + permission_overwrites=permission_overwrites, + category=category, + bitrate=bitrate, + user_limit=user_limit, + reason=reason, + ) async def create_category( self, From 03106fa2d455c9c057a39e4b10ffa99137c2d020 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 13 Mar 2024 21:46:21 +0000 Subject: [PATCH 2/2] ci: correct from checks. --- interactions/models/discord/channel.py | 4 ++-- interactions/models/discord/guild.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/interactions/models/discord/channel.py b/interactions/models/discord/channel.py index 441bbaae7..9c2260282 100644 --- a/interactions/models/discord/channel.py +++ b/interactions/models/discord/channel.py @@ -1599,7 +1599,7 @@ async def create_stage_channel( user_limit=user_limit, reason=reason, ) - + async def create_forum_channel( self, name: str, @@ -1638,7 +1638,7 @@ async def create_forum_channel( user_limit=user_limit, reason=reason, ) - + async def create_media_channel( self, name: str, diff --git a/interactions/models/discord/guild.py b/interactions/models/discord/guild.py index b63bde80e..819ba43a7 100644 --- a/interactions/models/discord/guild.py +++ b/interactions/models/discord/guild.py @@ -1203,7 +1203,7 @@ async def create_stage_channel( user_limit=user_limit, reason=reason, ) - + async def create_forum_channel( self, name: str, @@ -1245,7 +1245,7 @@ async def create_forum_channel( user_limit=user_limit, reason=reason, ) - + async def create_media_channel( self, name: str,