diff options
| author | Josh <[email protected]> | 2021-07-29 09:58:01 +1000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-07-28 19:58:01 -0400 |
| commit | 41e2d3c6370e2e5101245d9884094e314cb92182 (patch) | |
| tree | 020023fba365269823f81aa76d9462f85f1bbcef | |
| parent | Add audit log events for threads (diff) | |
| download | discord.py-41e2d3c6370e2e5101245d9884094e314cb92182.tar.xz discord.py-41e2d3c6370e2e5101245d9884094e314cb92182.zip | |
Allow callables in abc.Connectable.Connect
| -rw-r--r-- | discord/abc.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/discord/abc.py b/discord/abc.py index ffaa5feb..895083fd 100644 --- a/discord/abc.py +++ b/discord/abc.py @@ -28,6 +28,7 @@ import copy import asyncio from typing import ( Any, + Callable, Dict, List, Mapping, @@ -68,6 +69,7 @@ T = TypeVar('T', bound=VoiceProtocol) if TYPE_CHECKING: from datetime import datetime + from .client import Client from .user import ClientUser from .asset import Asset from .state import ConnectionState @@ -1611,7 +1613,13 @@ class Connectable(Protocol): def _get_voice_state_pair(self) -> Tuple[int, int]: raise NotImplementedError - async def connect(self, *, timeout: float = 60.0, reconnect: bool = True, cls: Type[T] = VoiceClient) -> T: + async def connect( + self, + *, + timeout: float = 60.0, + reconnect: bool = True, + cls: Callable[[Client, Connectable], T] = VoiceClient, + ) -> T: """|coro| Connects to voice and creates a :class:`VoiceClient` to establish |