From b903066e4dcc967dcc11ac9fa9be23840885fce4 Mon Sep 17 00:00:00 2001 From: SuzuZusu <79049600+SuzuZusu@users.noreply.github.com> Date: Wed, 24 Feb 2021 21:14:42 -0500 Subject: [PATCH] Allow for callable class factories in abc.Connectable.connect --- discord/abc.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/discord/abc.py b/discord/abc.py index dcd9279e5..a86a2a2d9 100644 --- a/discord/abc.py +++ b/discord/abc.py @@ -1138,9 +1138,6 @@ class Connectable(metaclass=abc.ABCMeta): A voice client that is fully connected to the voice server. """ - if not issubclass(cls, VoiceProtocol): - raise TypeError('Type must meet VoiceProtocol abstract base class.') - key_id, _ = self._get_voice_client_key() state = self._state @@ -1149,6 +1146,10 @@ class Connectable(metaclass=abc.ABCMeta): client = state._get_client() voice = cls(client, self) + + if not isinstance(voice, VoiceProtocol): + raise TypeError('Type must meet VoiceProtocol abstract base class.') + state._add_voice_client(key_id, voice) try: