mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-10-23 00:42:56 +00:00
Use typing.Self throughout library
This commit is contained in:
@@ -70,6 +70,8 @@ __all__ = (
|
||||
T = TypeVar('T', bound=VoiceProtocol)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing_extensions import Self
|
||||
|
||||
from .client import Client
|
||||
from .user import ClientUser
|
||||
from .asset import Asset
|
||||
@@ -216,9 +218,6 @@ class _Overwrites:
|
||||
return self.type == 1
|
||||
|
||||
|
||||
GCH = TypeVar('GCH', bound='GuildChannel')
|
||||
|
||||
|
||||
class GuildChannel:
|
||||
"""An ABC that details the common operations on a Discord guild channel.
|
||||
|
||||
@@ -817,12 +816,12 @@ class GuildChannel:
|
||||
raise TypeError('Invalid overwrite type provided.')
|
||||
|
||||
async def _clone_impl(
|
||||
self: GCH,
|
||||
self,
|
||||
base_attrs: Dict[str, Any],
|
||||
*,
|
||||
name: Optional[str] = None,
|
||||
reason: Optional[str] = None,
|
||||
) -> GCH:
|
||||
) -> Self:
|
||||
base_attrs['permission_overwrites'] = [x._asdict() for x in self._overwrites]
|
||||
base_attrs['parent_id'] = self.category_id
|
||||
base_attrs['name'] = name or self.name
|
||||
@@ -835,7 +834,7 @@ class GuildChannel:
|
||||
self.guild._channels[obj.id] = obj # type: ignore - obj is a GuildChannel
|
||||
return obj
|
||||
|
||||
async def clone(self: GCH, *, name: Optional[str] = None, reason: Optional[str] = None) -> GCH:
|
||||
async def clone(self, *, name: Optional[str] = None, reason: Optional[str] = None) -> Self:
|
||||
"""|coro|
|
||||
|
||||
Clones this channel. This creates a channel with the same properties
|
||||
|
Reference in New Issue
Block a user