add version comparison
This commit is contained in:
parent
85da3602a6
commit
3714656f0e
|
|
@ -92,3 +92,7 @@ class QueueFull(QueueException):
|
||||||
class QueueEmpty(QueueException):
|
class QueueEmpty(QueueException):
|
||||||
"""Exception raised when attempting to retrieve from an empty Queue."""
|
"""Exception raised when attempting to retrieve from an empty Queue."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
class LavalinkVersionIncompatible(PomiceException):
|
||||||
|
"""Lavalink version is incompatible. Must be using Lavalink > 3.7.0 to avoid this error."""
|
||||||
|
pass
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ from .enums import SearchType, NodeAlgorithm
|
||||||
from .exceptions import (
|
from .exceptions import (
|
||||||
AppleMusicNotEnabled,
|
AppleMusicNotEnabled,
|
||||||
InvalidSpotifyClientAuthorization,
|
InvalidSpotifyClientAuthorization,
|
||||||
|
LavalinkVersionIncompatible,
|
||||||
NodeConnectionFailure,
|
NodeConnectionFailure,
|
||||||
NodeCreationError,
|
NodeCreationError,
|
||||||
NodeNotAvailable,
|
NodeNotAvailable,
|
||||||
|
|
@ -283,9 +284,12 @@ class Node:
|
||||||
self._available = True
|
self._available = True
|
||||||
async with self._session.get(f'{self._rest_uri}/version', headers={"Authorization": self._password}) as resp:
|
async with self._session.get(f'{self._rest_uri}/version', headers={"Authorization": self._password}) as resp:
|
||||||
version: str = await resp.text()
|
version: str = await resp.text()
|
||||||
# To make version comparasion easier, lets remove the periods
|
version = version.replace(".", "")
|
||||||
# from the version numbers and compare them like whole numbers
|
if int(version) < 370:
|
||||||
print(version)
|
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
|
return self
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue