Skip to content

Commit 0cd9ac9

Browse files
solalusetpre-commit-ci[bot]Dorukyum
authored
fix(typing): proper VoiceClient.play() return value (Pycord-Development#2324)
* fix(typing): proper VoiceClient.play() return value * style(pre-commit): auto fixes from pre-commit.com hooks * fix(typing): mark after as optional Co-authored-by: Dorukyum <[email protected]> Signed-off-by: Krutyi-4el <[email protected]> * fix(typing): mark after as optional Co-authored-by: Dorukyum <[email protected]> Signed-off-by: Krutyi-4el <[email protected]> * fix(typing): mark after as optional Co-authored-by: Dorukyum <[email protected]> Signed-off-by: Krutyi-4el <[email protected]> --------- Signed-off-by: Krutyi-4el <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Dorukyum <[email protected]>
1 parent e0f9b10 commit 0cd9ac9

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

discord/voice_client.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
import struct
4747
import threading
4848
import time
49-
from typing import TYPE_CHECKING, Any, Callable
49+
from typing import TYPE_CHECKING, Any, Callable, Literal, overload
5050

5151
from . import opus, utils
5252
from .backoff import ExponentialBackoff
@@ -623,13 +623,33 @@ def get_ssrc(self, user_id):
623623
user_id
624624
]
625625

626+
@overload
626627
def play(
627628
self,
628629
source: AudioSource,
629630
*,
630-
after: Callable[[Exception | None], Any] = None,
631-
wait_finish: bool = False,
631+
after: Callable[[Exception | None], Any] | None = None,
632+
wait_finish: Literal[False] = False,
632633
) -> None:
634+
...
635+
636+
@overload
637+
def play(
638+
self,
639+
source: AudioSource,
640+
*,
641+
after: Callable[[Exception | None], Any] | None = None,
642+
wait_finish: Literal[True],
643+
) -> asyncio.Future:
644+
...
645+
646+
def play(
647+
self,
648+
source: AudioSource,
649+
*,
650+
after: Callable[[Exception | None], Any] | None = None,
651+
wait_finish: bool = False,
652+
) -> None | asyncio.Future:
633653
"""Plays an :class:`AudioSource`.
634654
635655
The finalizer, ``after`` is called after the source has been exhausted

0 commit comments

Comments
 (0)