diff --git a/channel.py b/channel.py index d1e5eed..1f8028f 100644 --- a/channel.py +++ b/channel.py @@ -52,6 +52,14 @@ class Channel: self.stream: Optional[Stream] = None await self.get_stream() + def __eq__(self, other: object): + if isinstance(other, self.__class__): + return self.id == other.id + return NotImplemented + + def __hash__(self) -> int: + return hash((self.__class__.__name__, self.id)) + @property def online(self) -> bool: """ diff --git a/constants.py b/constants.py index fe121f9..a9285e7 100644 --- a/constants.py +++ b/constants.py @@ -120,7 +120,7 @@ class WebsocketTopic: return NotImplemented def __hash__(self) -> int: - return hash(self.id) + return hash((self.__class__.__name__, self.id)) WEBSOCKET_TOPICS: Dict[str, str] = { diff --git a/inventory.py b/inventory.py index 1497956..cc615b6 100644 --- a/inventory.py +++ b/inventory.py @@ -39,7 +39,7 @@ class Game: return NotImplemented def __hash__(self) -> int: - return self.id + return hash((self.__class__.__name__, self.id)) class BaseDrop: