mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 20:28:38 +00:00
Allow callables in abc.Connectable.Connect
This commit is contained in:
parent
154c90ef59
commit
41e2d3c637
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user