diff --git a/interactions/api/models/misc.py b/interactions/api/models/misc.py index 3a92110f0..e2a6371b0 100644 --- a/interactions/api/models/misc.py +++ b/interactions/api/models/misc.py @@ -166,9 +166,15 @@ def timestamp(self) -> datetime.datetime: def __hash__(self): return hash(self._snowflake) - # Do we need not equals, equals, gt/lt/ge/le? - # If so, list them under. By Discord API this may not be needed - # but end users might. + def __eq__(self, other): + if isinstance(other, Snowflake): + return str(self) == str(other) + elif isinstance(other, int): + return int(self) == other + elif isinstance(other, str): + return str(self) == other + + return NotImplemented class Color(object): diff --git a/interactions/api/models/misc.pyi b/interactions/api/models/misc.pyi index 73613fd44..9a319f427 100644 --- a/interactions/api/models/misc.pyi +++ b/interactions/api/models/misc.pyi @@ -42,6 +42,7 @@ class Snowflake(object): def __hash__(self) -> int: ... def __str__(self) -> str: ... def __int__(self) -> int: ... + def __eq__(self, other) -> Union[bool, NotImplemented]: ... class Format: USER: str