5252from .state import VoiceConnectionState
5353
5454if TYPE_CHECKING :
55+ from typing import TypeVar
56+
5557 from typing_extensions import ParamSpec
5658
5759 from discord import abc
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