From 2963857e866ff9e92eb5def6f1f2ea54053e4645 Mon Sep 17 00:00:00 2001 From: chillymosh <86857777+chillymosh@users.noreply.github.com> Date: Wed, 26 Jul 2023 21:08:47 +0100 Subject: [PATCH] Add SpotifyTrack hash Add SpotifyTrack hash and change EQ for Playable to raise instead of return --- wavelink/ext/spotify/__init__.py | 5 ++++- wavelink/tracks.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/wavelink/ext/spotify/__init__.py b/wavelink/ext/spotify/__init__.py index 4a6a4c2c..38f3ed45 100644 --- a/wavelink/ext/spotify/__init__.py +++ b/wavelink/ext/spotify/__init__.py @@ -211,7 +211,10 @@ def __repr__(self) -> str: def __eq__(self, other) -> bool: if isinstance(other, SpotifyTrack): return self.id == other.id - raise NotImplemented + raise NotImplementedError + + def __hash__(self) -> int: + return hash(self.id) @classmethod async def search( diff --git a/wavelink/tracks.py b/wavelink/tracks.py index b55891c7..d13ecbcc 100644 --- a/wavelink/tracks.py +++ b/wavelink/tracks.py @@ -150,7 +150,7 @@ def __repr__(self) -> str: def __eq__(self, other: object) -> bool: if isinstance(other, Playable): return self.encoded == other.encoded - return NotImplemented + raise NotImplementedError @overload @classmethod