diff --git a/interactions/api/models/guild.py b/interactions/api/models/guild.py index 3edadda1b..2f211de7e 100644 --- a/interactions/api/models/guild.py +++ b/interactions/api/models/guild.py @@ -768,6 +768,25 @@ async def create_channel( return Channel(**res, _client=self._client) + async def clone_channel(self, channel_id: int) -> Channel: + """ + Clones a channel of the guild. + + :param channel_id: The id of the channel to clone + :type channel_id: int + :return: The cloned channel + :rtype: Channel + """ + if not self._client: + raise AttributeError("HTTPClient not found!") + res = await self._client.get_channel(channel_id=channel_id) + + res["permission_overwrites"] = [Overwrite(**_) for _ in res["permission_overwrites"]] + for attr in {"flags", "guild_id", "id", "last_message_id", "last_pin_timestamp"}: + res.pop(attr, None) + + return await self.create_channel(**res) + async def modify_channel( self, channel_id: int, diff --git a/interactions/api/models/guild.pyi b/interactions/api/models/guild.pyi index e9108a6cc..9b6c6083a 100644 --- a/interactions/api/models/guild.pyi +++ b/interactions/api/models/guild.pyi @@ -224,6 +224,10 @@ class Guild(DictSerializerMixin): nsfw: Optional[bool] = MISSING, reason: Optional[str] = None, ) -> Channel: ... + async def clone_channel( + self, + channel_id: int + ) -> Channel: ... async def modify_channel( self, channel_id: int,