From 217268c603f20ef1d564926928adbac16f73f3b5 Mon Sep 17 00:00:00 2001 From: cloudwithax Date: Sun, 1 Mar 2026 13:45:36 -0500 Subject: [PATCH 1/3] updating voice update data to include channelid as part of mandated DAVE protocol changes --- .gitattributes | 0 pomice/player.py | 3 +++ 2 files changed, 3 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..e69de29 diff --git a/pomice/player.py b/pomice/player.py index da8d24d..8c3b00b 100644 --- a/pomice/player.py +++ b/pomice/player.py @@ -313,6 +313,9 @@ class Player(VoiceProtocol): "sessionId": state["sessionId"], } + if self._node._version >= LavalinkVersion(4, 2, 0) and self.channel: + data["channelId"] = str(self.channel.id) + await self._node.send( method="PATCH", path=self._player_endpoint_uri, From 6991ff06f44d74c9c9bc3b7b87c03bad82c2f617 Mon Sep 17 00:00:00 2001 From: cloudwithax Date: Sun, 1 Mar 2026 13:46:20 -0500 Subject: [PATCH 2/3] 2.11.0 --- pomice/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pomice/__init__.py b/pomice/__init__.py index a2ae70c..df6ea40 100644 --- a/pomice/__init__.py +++ b/pomice/__init__.py @@ -20,7 +20,7 @@ if not discord.version_info.major >= 2: "using 'pip install discord.py'", ) -__version__ = "2.10.0" +__version__ = "2.11.0" __title__ = "pomice" __author__ = "cloudwithax" __license__ = "GPL-3.0" From 5c5d68d1f29dea195e83b26fbe2b8c9fe2796bdb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 11 Jun 2026 17:52:44 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pomice/pool.py | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/pomice/pool.py b/pomice/pool.py index b7b97ba..ac44ea8 100644 --- a/pomice/pool.py +++ b/pomice/pool.py @@ -18,7 +18,8 @@ from urllib.parse import quote import aiohttp import orjson as json -from discord import Client, VoiceChannel +from discord import Client +from discord import VoiceChannel from discord.ext import commands try: @@ -31,13 +32,7 @@ from websockets import exceptions from . import __version__ from . import applemusic from . import spotify -from .enums import ( - TrackType, - NodeAlgorithm, - PlaylistType, - SearchType, - URLRegex -) +from .enums import TrackType, NodeAlgorithm, PlaylistType, SearchType, URLRegex from .exceptions import InvalidSpotifyClientAuthorization from .exceptions import LavalinkVersionIncompatible from .exceptions import NodeConnectionFailure @@ -145,7 +140,7 @@ class Node: self._resume_timeout: int = resume_timeout self._secure: bool = secure self._fallback: bool = fallback - + self._location = location self._websocket_uri: str = f"{'wss' if self._secure else 'ws'}://{self._host}:{self._port}" @@ -218,13 +213,13 @@ class Node: def bot(self) -> Client: """Property which returns the discord.py client linked to this node""" return self._bot - + @property def location(self) -> str: """ Property which returns the default region unless set specifically """ - + return self._location @property @@ -984,7 +979,9 @@ class NodePool: return len(self._nodes.values()) @classmethod - def get_best_node(cls, *, algorithm: NodeAlgorithm, channel: Optional[VoiceChannel] = None) -> Node: + def get_best_node( + cls, *, algorithm: NodeAlgorithm, channel: Optional[VoiceChannel] = None, + ) -> Node: """Fetches the best node based on an NodeAlgorithm. This option is preferred if you want to choose the best node from a multi-node setup using either the node's latency @@ -998,7 +995,7 @@ class NodePool: based on how players it has. This method will return a node with the least amount of players """ - + available_nodes: List[Node] = [node for node in cls._nodes.values() if node._available] if not available_nodes: @@ -1011,20 +1008,19 @@ class NodePool: elif algorithm == NodeAlgorithm.by_players: tested_nodes = {node: len(node.players.keys()) for node in available_nodes} return min(tested_nodes, key=tested_nodes.get) # type: ignore - + elif algorithm == NodeAlgorithm.by_location and isinstance(channel, VoiceChannel): - tested_nodes = {} + tested_nodes = {} chosen_region = channel.rtc_region - + if not chosen_region: return cls.get_best_node(algorithm=NodeAlgorithm.by_ping) - - if (node := next( - (node for node in available_nodes if node.location == chosen_region), - None - )): + + if node := next( + (node for node in available_nodes if node.location == chosen_region), None, + ): return node - + return random.choice(available_nodes) else: raise ValueError(