mirror of
				https://github.com/Rapptz/discord.py.git
				synced 2025-11-04 07:22:50 +00:00 
			
		
		
		
	Update all channel clone implementations
This commit is contained in:
		@@ -527,7 +527,15 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
 | 
			
		||||
    @utils.copy_doc(discord.abc.GuildChannel.clone)
 | 
			
		||||
    async def clone(self, *, name: Optional[str] = None, reason: Optional[str] = None) -> TextChannel:
 | 
			
		||||
        return await self._clone_impl(
 | 
			
		||||
            {'topic': self.topic, 'nsfw': self.nsfw, 'rate_limit_per_user': self.slowmode_delay}, name=name, reason=reason
 | 
			
		||||
            {
 | 
			
		||||
                'topic': self.topic,
 | 
			
		||||
                'rate_limit_per_user': self.slowmode_delay,
 | 
			
		||||
                'nsfw': self.nsfw,
 | 
			
		||||
                'default_auto_archive_duration': self.default_auto_archive_duration,
 | 
			
		||||
                'default_thread_rate_limit_per_user': self.default_thread_slowmode_delay,
 | 
			
		||||
            },
 | 
			
		||||
            name=name,
 | 
			
		||||
            reason=reason,
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    async def delete_messages(self, messages: Iterable[Snowflake], *, reason: Optional[str] = None) -> None:
 | 
			
		||||
@@ -1379,6 +1387,24 @@ class VocalGuildChannel(discord.abc.Messageable, discord.abc.Connectable, discor
 | 
			
		||||
        data = await self._state.http.create_webhook(self.id, name=str(name), avatar=avatar, reason=reason)
 | 
			
		||||
        return Webhook.from_state(data, state=self._state)
 | 
			
		||||
 | 
			
		||||
    @utils.copy_doc(discord.abc.GuildChannel.clone)
 | 
			
		||||
    async def clone(self, *, name: Optional[str] = None, reason: Optional[str] = None) -> Self:
 | 
			
		||||
        base = {
 | 
			
		||||
            'bitrate': self.bitrate,
 | 
			
		||||
            'user_limit': self.user_limit,
 | 
			
		||||
            'rate_limit_per_user': self.slowmode_delay,
 | 
			
		||||
            'nsfw': self.nsfw,
 | 
			
		||||
            'video_quality_mode': self.video_quality_mode.value,
 | 
			
		||||
        }
 | 
			
		||||
        if self.rtc_region:
 | 
			
		||||
            base['rtc_region'] = self.rtc_region
 | 
			
		||||
 | 
			
		||||
        return await self._clone_impl(
 | 
			
		||||
            base,
 | 
			
		||||
            name=name,
 | 
			
		||||
            reason=reason,
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class VoiceChannel(VocalGuildChannel):
 | 
			
		||||
    """Represents a Discord guild voice channel.
 | 
			
		||||
@@ -1473,10 +1499,6 @@ class VoiceChannel(VocalGuildChannel):
 | 
			
		||||
        """:class:`ChannelType`: The channel's Discord type."""
 | 
			
		||||
        return ChannelType.voice
 | 
			
		||||
 | 
			
		||||
    @utils.copy_doc(discord.abc.GuildChannel.clone)
 | 
			
		||||
    async def clone(self, *, name: Optional[str] = None, reason: Optional[str] = None) -> VoiceChannel:
 | 
			
		||||
        return await self._clone_impl({'bitrate': self.bitrate, 'user_limit': self.user_limit}, name=name, reason=reason)
 | 
			
		||||
 | 
			
		||||
    @overload
 | 
			
		||||
    async def edit(self) -> None:
 | 
			
		||||
        ...
 | 
			
		||||
@@ -1747,10 +1769,6 @@ class StageChannel(VocalGuildChannel):
 | 
			
		||||
        """:class:`ChannelType`: The channel's Discord type."""
 | 
			
		||||
        return ChannelType.stage_voice
 | 
			
		||||
 | 
			
		||||
    @utils.copy_doc(discord.abc.GuildChannel.clone)
 | 
			
		||||
    async def clone(self, *, name: Optional[str] = None, reason: Optional[str] = None) -> StageChannel:
 | 
			
		||||
        return await self._clone_impl({}, name=name, reason=reason)
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def instance(self) -> Optional[StageInstance]:
 | 
			
		||||
        """Optional[:class:`StageInstance`]: The running stage instance of the stage channel.
 | 
			
		||||
@@ -2546,8 +2564,25 @@ class ForumChannel(discord.abc.GuildChannel, Hashable):
 | 
			
		||||
 | 
			
		||||
    @utils.copy_doc(discord.abc.GuildChannel.clone)
 | 
			
		||||
    async def clone(self, *, name: Optional[str] = None, reason: Optional[str] = None) -> ForumChannel:
 | 
			
		||||
        base = {
 | 
			
		||||
            'topic': self.topic,
 | 
			
		||||
            'rate_limit_per_user': self.slowmode_delay,
 | 
			
		||||
            'nsfw': self.nsfw,
 | 
			
		||||
            'default_auto_archive_duration': self.default_auto_archive_duration,
 | 
			
		||||
            'available_tags': [tag.to_dict() for tag in self.available_tags],
 | 
			
		||||
            'default_thread_rate_limit_per_user': self.default_thread_slowmode_delay,
 | 
			
		||||
        }
 | 
			
		||||
        if self.default_sort_order:
 | 
			
		||||
            base['default_sort_order'] = self.default_sort_order.value
 | 
			
		||||
        if self.default_reaction_emoji:
 | 
			
		||||
            base['default_reaction_emoji'] = self.default_reaction_emoji._to_forum_tag_payload()
 | 
			
		||||
        if not self.is_media() and self.default_layout:
 | 
			
		||||
            base['default_forum_layout'] = self.default_layout.value
 | 
			
		||||
 | 
			
		||||
        return await self._clone_impl(
 | 
			
		||||
            {'topic': self.topic, 'nsfw': self.nsfw, 'rate_limit_per_user': self.slowmode_delay}, name=name, reason=reason
 | 
			
		||||
            base,
 | 
			
		||||
            name=name,
 | 
			
		||||
            reason=reason,
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    @overload
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user