Skip to content

Commit

Permalink
Add eq dunder to User
Browse files Browse the repository at this point in the history
  • Loading branch information
EvieePy committed Jan 5, 2025
1 parent 69b2490 commit 74c95c9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions twitchio/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ def __repr__(self) -> str:
def __str__(self) -> str:
return self.name or "..."

def __eq__(self, other: object) -> bool:
if not isinstance(other, (PartialUser, User, Chatter)):
return NotImplemented

return self.id == other.id

@property
def mention(self) -> str:
"""Property returning the users display_name formatted to mention them in chat.
Expand Down

0 comments on commit 74c95c9

Please sign in to comment.