mirror of
https://github.com/yawaflua/Flask-Discord.git
synced 2025-12-10 04:19:31 +02:00
Add a __eq__ and __ne__ to models Guild and User
This commit is contained in:
@@ -78,6 +78,12 @@ class User(DiscordModelsBase):
|
||||
def __str__(self):
|
||||
return f"{self.name}#{self.discriminator}"
|
||||
|
||||
def __eq__(self, user):
|
||||
return isinstance(user, User) and user.id == self.id
|
||||
|
||||
def __ne__(self, user):
|
||||
return not self.__eq__(user)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""An alias to the username attribute."""
|
||||
|
||||
Reference in New Issue
Block a user