Skip to content

Commit 6aafaa5

Browse files
committed
fix: TypeVar ParamSpec
1 parent 9716630 commit 6aafaa5

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

discord/voice/client.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
from .state import VoiceConnectionState
5353

5454
if TYPE_CHECKING:
55+
from typing import TypeVar
56+
5557
from typing_extensions import ParamSpec
5658

5759
from discord import abc
@@ -71,6 +73,7 @@
7173
from .receive.reader import AfterCallback
7274

7375
P = ParamSpec("P")
76+
T = TypeVar("T")
7477

7578
_log = logging.getLogger(__name__)
7679

@@ -255,10 +258,10 @@ async def _recv_hook(self, ws: VoiceWebSocket, msg: dict[str, Any]) -> None:
255258

256259
async def _run_event(
257260
self,
258-
coro: Callable[..., Coroutine[Any, Any, None]],
261+
coro: Callable[..., Coroutine[P, None]],
259262
event_name: str,
260-
*args: Any,
261-
**kwargs: Any,
263+
*args: P.args,
264+
**kwargs: P.kwargs,
262265
) -> None:
263266
try:
264267
await coro(*args, **kwargs)
@@ -269,11 +272,11 @@ async def _run_event(
269272

270273
def _schedule_event(
271274
self,
272-
coro: Callable[..., Coroutine[Any, Any, None]],
275+
coro: Callable[..., Coroutine[Any, Any, T]],
273276
event_name: str,
274277
*args: Any,
275278
**kwargs: Any,
276-
) -> asyncio.Task[None]:
279+
) -> asyncio.Task[T]:
277280
wrapped = self._run_event(coro, event_name, *args, **kwargs)
278281
return self.client.loop.create_task(
279282
wrapped, name=f"voice-receiver-event-dispatch: {event_name}"

0 commit comments

Comments
 (0)