Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
a98025a
first commit on voice fixes
DA-344 Aug 21, 2025
0ea2077
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 21, 2025
56caff5
things
DA-344 Aug 26, 2025
b27b438
merge upstream
DA-344 Aug 26, 2025
098a280
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 26, 2025
8a6ae39
finish voice things, start voice-recv things
DA-344 Aug 26, 2025
f231d72
missing imports
DA-344 Aug 26, 2025
24d2db0
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 26, 2025
63b4d85
protocols
DA-344 Aug 26, 2025
d7be710
Merge branch 'feat/voice-rewrite-and-fixes' of https://github.com/DA-…
DA-344 Aug 26, 2025
fe88ee8
recv
DA-344 Aug 26, 2025
726c8f9
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 26, 2025
fbab980
fix voice connection, now fix voice recording :sob:
DA-344 Aug 26, 2025
266591d
Merge branch 'feat/voice-rewrite-and-fixes' of https://github.com/DA-…
DA-344 Aug 26, 2025
870d135
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 26, 2025
73d5c6d
actually i did this for logging
DA-344 Aug 26, 2025
109a06c
merge upstream
DA-344 Aug 26, 2025
8f891a3
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 26, 2025
eaa3d77
use utils._get_as_snowflake and remove old code
DA-344 Aug 26, 2025
1a40295
Merge branch 'feat/voice-rewrite-and-fixes' of https://github.com/DA-…
DA-344 Aug 26, 2025
def162d
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 26, 2025
c81adf5
remove fmt:off references
DA-344 Aug 26, 2025
d5bae0d
Merge branch 'feat/voice-rewrite-and-fixes' of https://github.com/DA-…
DA-344 Aug 26, 2025
88175b6
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 26, 2025
753e11b
add voice to the packages
DA-344 Aug 26, 2025
51858b9
keep GuildVoiceState alias to VoiceState
DA-344 Aug 26, 2025
b414b5f
fix type annotation
DA-344 Aug 26, 2025
9030478
voice recv things
DA-344 Aug 27, 2025
0b7c147
refactor voice recv logic
DA-344 Aug 30, 2025
83036da
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 30, 2025
4277b49
document default handlers
DA-344 Aug 30, 2025
46978ec
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 30, 2025
6c124bf
fix await outside async
DA-344 Aug 30, 2025
b34c254
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 30, 2025
18ded59
name error
DA-344 Aug 30, 2025
6f03ace
fix dispatchs not working ig
DA-344 Aug 30, 2025
94d3082
fix voice recv things fuck
DA-344 Aug 30, 2025
fe8e602
try to fix things
DA-344 Aug 30, 2025
212ce1d
voice recv is no longer funny
DA-344 Aug 31, 2025
628d5f6
merge master
DA-344 Aug 31, 2025
109d27c
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 31, 2025
a0f2a99
Merge branch 'master' of https://github.com/Pycord-Development/pycord…
DA-344 Sep 8, 2025
8304dba
add first pass to implement dave
DA-344 Sep 9, 2025
74d6590
yay voice recv
DA-344 Sep 11, 2025
60658bb
more voice recv
DA-344 Sep 12, 2025
d44f192
docs actions
DA-344 Sep 12, 2025
135550f
errors yay
DA-344 Sep 12, 2025
a324844
okay this needs fixing
DA-344 Sep 12, 2025
805d055
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 12, 2025
a49cddf
voice changes
DA-344 Jan 9, 2026
bcc841d
split voice connect from recv
DA-344 Feb 26, 2026
8c3ce89
some type fixes
DA-344 Feb 26, 2026
58bf955
remove unused imports
DA-344 Feb 26, 2026
c4a7cd7
merge master
DA-344 Feb 26, 2026
cd8f108
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 26, 2026
6897f44
some more type fixes and warning for recv
DA-344 Mar 3, 2026
78e44c9
chore: merge upstream
DA-344 Mar 3, 2026
740d822
chore: merge master
DA-344 Mar 3, 2026
be86c86
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 3, 2026
4f6040f
fix sinks docs
DA-344 Mar 3, 2026
a9e679c
Merge branch 'feat/voice-rewrite-and-fixes' of https://github.com/DA-…
DA-344 Mar 3, 2026
27da98c
fix docs
DA-344 Mar 3, 2026
bf18aba
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 3, 2026
5c98cdb
idk what happened here
DA-344 Mar 3, 2026
a55b01c
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 3, 2026
e9ec992
maybe fix circular
DA-344 Mar 3, 2026
b50761e
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 3, 2026
54db8bd
disliking docs atp
DA-344 Mar 3, 2026
8f99e4e
add voice to docs requirements
DA-344 Mar 3, 2026
23e474f
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 3, 2026
fe6e38c
add voice to docs reqs
DA-344 Mar 3, 2026
b4f9479
add voice to tests
DA-344 Mar 3, 2026
2189888
type fixes
DA-344 Mar 3, 2026
8ee5aec
remove undefined names from __all__
DA-344 Mar 3, 2026
48e23f2
add davey try/except imports and warn on init
DA-344 Mar 4, 2026
5d1244e
emit davey warning on discord.Client
DA-344 Mar 4, 2026
1ee4a1e
fix tox tests
DA-344 Mar 4, 2026
0f59da6
Merge branch 'master' into feat/voice-rewrite-and-fixes
DA-344 Mar 4, 2026
68e0eeb
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 4, 2026
9c5323c
fix VoiceClient & VoiceProtocol docs
DA-344 Mar 4, 2026
611a4fb
Update discord/voice/client.py
DA-344 Mar 5, 2026
5e4209c
Update discord/voice/packets/__init__.py
DA-344 Mar 5, 2026
5c3747c
Update discord/voice/receive/router.py
DA-344 Mar 5, 2026
2932df8
Update discord/__init__.py
DA-344 Mar 5, 2026
4bb65ad
:recycle: Refactor deprecated `VoiceClient` and `VoiceProtocol` aliases
Paillat-dev Mar 9, 2026
b405989
voice: avoid event-loop blocking during channel move wait
Lulalaby Mar 8, 2026
5d9dda8
:loud_sound: Add warnings for broken voice reception
Paillat-dev Mar 9, 2026
0c505fa
fix: typo
Lulalaby Mar 9, 2026
4f2c385
refactor: Undo client changes
Paillat-dev Mar 12, 2026
b42588f
Merge branch 'master' into feat/dave
Paillat-dev Mar 12, 2026
4824eaa
chore: Add missing license headers to voice modules
Paillat-dev Mar 12, 2026
b42f788
fix: Prevent double-calling set_result on future
Paillat-dev Mar 13, 2026
8223ac7
Merge branch 'master' into feat/dave
Paillat-dev Mar 13, 2026
f8dffa7
refactor: Cleanup missing deps and fix import issue
Paillat-dev Mar 14, 2026
96d4992
:white_check_mark: Add voice and novoice tests
Paillat-dev Mar 14, 2026
5001ff6
fix: Add back nacl imports
Paillat-dev Mar 14, 2026
379170e
fix: Use warnings.deprecated instead of utils.deprecated
Paillat-dev Mar 14, 2026
b829e53
chore: Add license to tests
Paillat-dev Mar 14, 2026
7422644
docs: Fix deprecation warnings to be correct
Paillat-dev Mar 14, 2026
784bbbf
Apply suggestion from @Lulalaby
Lulalaby Mar 14, 2026
bf829b4
Merge branch 'master' into feat/dave
Lulalaby Mar 14, 2026
1360c90
Revert "Apply suggestion from @Lulalaby"
Lulalaby Mar 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docs-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install -U pip
pip install ".[docs]"
pip install ".[docs,voice]"
- name: "Check Links"
if: ${{ github.event_name == 'schedule' || inputs.with_linkcheck }}
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs-json-export.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
id: install-deps
run: |
python -m pip install -U pip
pip install ".[docs]"
pip install ".[docs,voice]"
pip install beautifulsoup4
- name: Build Sphinx HTML docs
id: build-sphinx
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/lib-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install . --group dev
pip install .[voice]

- name: "Run tests"
run: tox
Expand Down
1 change: 1 addition & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ python:
path: .
extra_requirements:
- docs
- voice
2 changes: 1 addition & 1 deletion discord/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@


from . import abc, opus, sinks, ui, utils
from ._voice_aliases import *
from .activity import *
from .appinfo import *
from .application_role_connection import *
Expand Down Expand Up @@ -74,7 +75,6 @@
from .template import *
from .threads import *
from .user import *
from .voice_client import *
from .webhook import *
from .welcome_screen import *
from .widget import *
Expand Down
60 changes: 60 additions & 0 deletions discord/_voice_aliases.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
"""
The MIT License (MIT)

Copyright (c) 2015-2021 Rapptz
Copyright (c) 2021-present Pycord Development

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""

from typing import TYPE_CHECKING, Any

from typing_extensions import deprecated

if TYPE_CHECKING:
from discord.voice import VoiceClient as VoiceClientC
from discord.voice import VoiceProtocol as VoiceProtocolC

"""
since discord.voice raises an error when importing it without having the
required package (ie davey) installed, we can't import it in __init__ because
that would break the whole library, that is why this file is here.

the error would still be raised, but at least here we have more freedom on how we are typing it
"""

__all__ = ("VoiceProtocol", "VoiceClient")


@deprecated(
"discord.VoiceClient is deprecated in favour of discord.voice.VoiceClient since 2.7 and will be removed in 3.0",
)
def VoiceClient(*args: Any, **kwargs: Any) -> "VoiceClientC":
from discord.voice import VoiceClient as VoiceClientC

return VoiceClientC(*args, **kwargs)


@deprecated(
"discord.VoiceProtocol is deprecated in favour of discord.voice.VoiceProtocol since 2.7 and will be removed in 3.0",
)
def VoiceProtocol(*args: Any, **kwargs: Any) -> "VoiceProtocolC":
from discord.voice import VoiceProtocol as VoiceProtocolC

return VoiceProtocolC(*args, **kwargs)
20 changes: 16 additions & 4 deletions discord/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
from .scheduled_events import ScheduledEvent
from .sticker import GuildSticker, StickerItem
from .utils import warn_deprecated
from .voice_client import VoiceClient, VoiceProtocol

__all__ = (
"Snowflake",
Expand All @@ -69,8 +68,6 @@
"Mentionable",
)

T = TypeVar("T", bound=VoiceProtocol)

if TYPE_CHECKING:
from datetime import datetime

Expand Down Expand Up @@ -106,6 +103,10 @@
MessageableChannel = Union[PartialMessageableChannel, GroupChannel]
SnowflakeTime = Union["Snowflake", datetime]

from .voice import VoiceClient, VoiceProtocol

T = TypeVar("T", bound=VoiceProtocol)

MISSING = utils.MISSING


Expand Down Expand Up @@ -2003,6 +2004,7 @@ class Connectable(Protocol):

__slots__ = ()
_state: ConnectionState
id: int

def _get_voice_client_key(self) -> tuple[int, str]:
raise NotImplementedError
Expand All @@ -2015,7 +2017,7 @@ async def connect(
*,
timeout: float = 60.0,
reconnect: bool = True,
cls: Callable[[Client, Connectable], T] = VoiceClient,
cls: Callable[[Client, Connectable], T] = MISSING,
) -> T:
"""|coro|

Expand Down Expand Up @@ -2051,6 +2053,16 @@ async def connect(
The opus library has not been loaded.
"""

# import directly from _types so if the user does not have davey
# it won't error here
from .voice._types import VoiceProtocol

if cls is MISSING:
# if the user passes no cls, then actually import VoiceClient
from .voice import VoiceClient

cls = VoiceClient # pyright: ignore[reportAssignmentType]

key_id, _ = self._get_voice_client_key()
state = self._state

Expand Down
2 changes: 1 addition & 1 deletion discord/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1626,7 +1626,7 @@ def _update(
self, guild: Guild, data: VoiceChannelPayload | StageChannelPayload
) -> None:
# This data will always exist
self.guild = guild
self.guild: Guild = guild
self.name: str = data["name"]
self.category_id: int | None = utils._get_as_snowflake(data, "parent_id")

Expand Down
12 changes: 5 additions & 7 deletions discord/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
)

import aiohttp
from typing_extensions import deprecated
from typing_extensions import Self, deprecated

from . import utils
from .activity import ActivityTypes, BaseActivity, create_activity
Expand Down Expand Up @@ -71,7 +71,7 @@
from .ui.view import BaseView
from .user import ClientUser, User
from .utils import _D, _FETCHABLE, MISSING
from .voice_client import VoiceClient
from .voice.utils.dependencies import warn_if_voice_dependencies_missing
from .webhook import Webhook
from .widget import Widget

Expand All @@ -87,7 +87,7 @@
from .soundboard import SoundboardSound
from .threads import Thread
from .ui.item import ViewItem
from .voice_client import VoiceProtocol
from .voice import VoiceProtocol

__all__ = ("Client",)

Expand Down Expand Up @@ -282,9 +282,7 @@ def __init__(
self._connection._get_client = lambda: self
self._event_handlers: dict[str, list[Coro]] = {}

if VoiceClient.warn_nacl:
VoiceClient.warn_nacl = False
_log.warning("PyNaCl is not installed, voice will NOT be supported")
warn_if_voice_dependencies_missing()

# Used to hard-reference tasks so they don't get garbage collected (discarded with done_callbacks)
self._tasks = set()
Expand Down Expand Up @@ -421,7 +419,7 @@ def private_channels(self) -> list[PrivateChannel]:
return self._connection.private_channels

@property
def voice_clients(self) -> list[VoiceProtocol]:
def voice_clients(self) -> list[VoiceProtocol[Self]]:
"""Represents a list of voice connections.

These are usually :class:`.VoiceClient` instances.
Expand Down
2 changes: 1 addition & 1 deletion discord/commands/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
from ..state import ConnectionState
from ..ui import BaseView
from ..user import User
from ..voice_client import VoiceClient
from ..voice import VoiceClient
from ..webhook import WebhookMessage
from .core import ApplicationCommand, Option

Expand Down
2 changes: 1 addition & 1 deletion discord/ext/commands/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from discord.member import Member
from discord.state import ConnectionState
from discord.user import ClientUser, User
from discord.voice_client import VoiceProtocol
from discord.voice import VoiceProtocol

from .bot import AutoShardedBot, Bot
from .cog import Cog
Expand Down
Loading
Loading