mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-18 15:06:07 +00:00
Fix abc.GuildChannel.clone implementations
This commit is contained in:
parent
c5e74068f0
commit
354ae4208c
@ -1039,10 +1039,6 @@ class GuildChannel:
|
||||
|
||||
.. versionadded:: 1.1
|
||||
|
||||
.. versionchanged:: 2.5
|
||||
|
||||
The ``category`` keyword-only parameter was added.
|
||||
|
||||
Parameters
|
||||
------------
|
||||
name: Optional[:class:`str`]
|
||||
@ -1051,6 +1047,8 @@ class GuildChannel:
|
||||
category: Optional[:class:`~discord.CategoryChannel`]
|
||||
The category the new channel belongs to.
|
||||
This parameter is ignored if cloning a category channel.
|
||||
|
||||
.. versionadded:: 2.5
|
||||
reason: Optional[:class:`str`]
|
||||
The reason for cloning this channel. Shows up on the audit log.
|
||||
|
||||
|
@ -532,14 +532,16 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
|
||||
category: Optional[CategoryChannel] = None,
|
||||
reason: Optional[str] = None,
|
||||
) -> TextChannel:
|
||||
base: Dict[Any, Any] = {
|
||||
'topic': self.topic,
|
||||
'nsfw': self.nsfw,
|
||||
'default_auto_archive_duration': self.default_auto_archive_duration,
|
||||
'default_thread_rate_limit_per_user': self.default_thread_slowmode_delay,
|
||||
}
|
||||
if not self.is_news():
|
||||
base['rate_limit_per_user'] = self.slowmode_delay
|
||||
return await self._clone_impl(
|
||||
{
|
||||
'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,
|
||||
},
|
||||
base,
|
||||
name=name,
|
||||
category=category,
|
||||
reason=reason,
|
||||
@ -1395,7 +1397,9 @@ class VocalGuildChannel(discord.abc.Messageable, discord.abc.Connectable, discor
|
||||
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:
|
||||
async def clone(
|
||||
self, *, name: Optional[str] = None, category: Optional[CategoryChannel] = None, reason: Optional[str] = None
|
||||
) -> Self:
|
||||
base = {
|
||||
'bitrate': self.bitrate,
|
||||
'user_limit': self.user_limit,
|
||||
@ -1409,6 +1413,7 @@ class VocalGuildChannel(discord.abc.Messageable, discord.abc.Connectable, discor
|
||||
return await self._clone_impl(
|
||||
base,
|
||||
name=name,
|
||||
category=category,
|
||||
reason=reason,
|
||||
)
|
||||
|
||||
@ -1506,18 +1511,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,
|
||||
category: Optional[CategoryChannel] = None,
|
||||
reason: Optional[str] = None,
|
||||
) -> VoiceChannel:
|
||||
return await self._clone_impl(
|
||||
{'bitrate': self.bitrate, 'user_limit': self.user_limit}, name=name, category=category, reason=reason
|
||||
)
|
||||
|
||||
@overload
|
||||
async def edit(self) -> None:
|
||||
...
|
||||
@ -1788,16 +1781,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,
|
||||
category: Optional[CategoryChannel] = None,
|
||||
reason: Optional[str] = None,
|
||||
) -> StageChannel:
|
||||
return await self._clone_impl({}, name=name, category=category, reason=reason)
|
||||
|
||||
@property
|
||||
def instance(self) -> Optional[StageInstance]:
|
||||
"""Optional[:class:`StageInstance`]: The running stage instance of the stage channel.
|
||||
|
Loading…
x
Reference in New Issue
Block a user