From ad34914afdb094971e6fe91ece2e3c7ede280b03 Mon Sep 17 00:00:00 2001 From: EvieePy Date: Sat, 23 Dec 2023 08:21:00 +1000 Subject: [PATCH 1/4] Fix: node.players now returns a copy. --- wavelink/node.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/wavelink/node.py b/wavelink/node.py index 58533780..84b067a4 100644 --- a/wavelink/node.py +++ b/wavelink/node.py @@ -207,8 +207,14 @@ def status(self) -> NodeStatus: @property def players(self) -> dict[int, Player]: - """A mapping of :attr:`discord.Guild.id` to :class:`~wavelink.Player`.""" - return self._players + """A mapping of :attr:`discord.Guild.id` to :class:`~wavelink.Player`. + + + .. versionchanged:: 3.2.0 + + This property now returns a shallow copy of the internal mapping. + """ + return self._players.copy() @property def client(self) -> discord.Client | None: From 9ae4e7f32b53b7a6cf0517fc015180031235050a Mon Sep 17 00:00:00 2001 From: EvieePy Date: Sat, 23 Dec 2023 08:22:16 +1000 Subject: [PATCH 2/4] Run black --- wavelink/node.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wavelink/node.py b/wavelink/node.py index 84b067a4..de8b38b9 100644 --- a/wavelink/node.py +++ b/wavelink/node.py @@ -208,10 +208,10 @@ def status(self) -> NodeStatus: @property def players(self) -> dict[int, Player]: """A mapping of :attr:`discord.Guild.id` to :class:`~wavelink.Player`. - - + + .. versionchanged:: 3.2.0 - + This property now returns a shallow copy of the internal mapping. """ return self._players.copy() From 82d48bcf18afe45135e81dbc7d6ff0c333315b5d Mon Sep 17 00:00:00 2001 From: EvieePy Date: Sat, 23 Dec 2023 08:42:37 +1000 Subject: [PATCH 3/4] Release this as a fix --- wavelink/node.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wavelink/node.py b/wavelink/node.py index de8b38b9..63a445e4 100644 --- a/wavelink/node.py +++ b/wavelink/node.py @@ -210,7 +210,7 @@ def players(self) -> dict[int, Player]: """A mapping of :attr:`discord.Guild.id` to :class:`~wavelink.Player`. - .. versionchanged:: 3.2.0 + .. versionchanged:: 3.1.1 This property now returns a shallow copy of the internal mapping. """ From 4f7d0e6164bd61723918caa3cef8f03df53bba66 Mon Sep 17 00:00:00 2001 From: EvieePy Date: Sat, 23 Dec 2023 17:22:55 +1000 Subject: [PATCH 4/4] Fix: Bug in custom player connections that results in the player not being added to Node.players --- wavelink/player.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wavelink/player.py b/wavelink/player.py index 88035f0f..8e1d9cd9 100644 --- a/wavelink/player.py +++ b/wavelink/player.py @@ -513,7 +513,8 @@ async def connect( if not self._guild: self._guild = self.channel.guild - self.node._players[self._guild.id] = self + + self.node._players[self._guild.id] = self assert self.guild is not None await self.guild.change_voice_state(channel=self.channel, self_mute=self_mute, self_deaf=self_deaf)