diff --git a/pomice/exceptions.py b/pomice/exceptions.py index 8d2cb24..9eeac42 100644 --- a/pomice/exceptions.py +++ b/pomice/exceptions.py @@ -92,3 +92,7 @@ class QueueFull(QueueException): class QueueEmpty(QueueException): """Exception raised when attempting to retrieve from an empty Queue.""" pass + +class LavalinkVersionIncompatible(PomiceException): + """Lavalink version is incompatible. Must be using Lavalink > 3.7.0 to avoid this error.""" + pass diff --git a/pomice/pool.py b/pomice/pool.py index a3dbd6c..f4b9199 100644 --- a/pomice/pool.py +++ b/pomice/pool.py @@ -21,6 +21,7 @@ from .enums import SearchType, NodeAlgorithm from .exceptions import ( AppleMusicNotEnabled, InvalidSpotifyClientAuthorization, + LavalinkVersionIncompatible, NodeConnectionFailure, NodeCreationError, NodeNotAvailable, @@ -283,9 +284,12 @@ class Node: self._available = True async with self._session.get(f'{self._rest_uri}/version', headers={"Authorization": self._password}) as resp: version: str = await resp.text() - # To make version comparasion easier, lets remove the periods - # from the version numbers and compare them like whole numbers - print(version) + version = version.replace(".", "") + if int(version) < 370: + raise LavalinkVersionIncompatible( + "The Lavalink version you're using is incompatible." + "Lavalink version 3.7.0 or above is required to use this library." + ) return self