mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-07-11 12:28:03 +00:00
Fix Connectable.connect typing having bad inference if cls is missing
This commit is contained in:
parent
9d17c3acde
commit
04f5fcf741
@ -1814,7 +1814,7 @@ class Connectable(Protocol):
|
|||||||
*,
|
*,
|
||||||
timeout: float = 60.0,
|
timeout: float = 60.0,
|
||||||
reconnect: bool = True,
|
reconnect: bool = True,
|
||||||
cls: Callable[[Client, Connectable], T] = MISSING,
|
cls: Callable[[Client, Connectable], T] = VoiceClient,
|
||||||
self_deaf: bool = False,
|
self_deaf: bool = False,
|
||||||
self_mute: bool = False,
|
self_mute: bool = False,
|
||||||
) -> T:
|
) -> T:
|
||||||
@ -1867,12 +1867,7 @@ class Connectable(Protocol):
|
|||||||
raise ClientException('Already connected to a voice channel.')
|
raise ClientException('Already connected to a voice channel.')
|
||||||
|
|
||||||
client = state._get_client()
|
client = state._get_client()
|
||||||
|
voice: T = cls(client, self)
|
||||||
if cls is MISSING:
|
|
||||||
cls = VoiceClient
|
|
||||||
|
|
||||||
# The type checker doesn't understand that VoiceClient *is* T here.
|
|
||||||
voice: T = cls(client, self) # type: ignore
|
|
||||||
|
|
||||||
if not isinstance(voice, VoiceProtocol):
|
if not isinstance(voice, VoiceProtocol):
|
||||||
raise TypeError('Type must meet VoiceProtocol abstract base class.')
|
raise TypeError('Type must meet VoiceProtocol abstract base class.')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user