Add a __eq__ and __ne__ to models Guild and User

This commit is contained in:
A-Trash-Coder
2020-05-20 21:45:46 -04:00
parent 4a2440ea53
commit 857fd4c4ad
2 changed files with 12 additions and 0 deletions

View File

@@ -35,6 +35,12 @@ class Guild(DiscordModelsBase):
def __str__(self):
return self.name
def __eq__(self, guild):
return isinstance(guild, Guild) and guild.id == self.id
def __ne__(self, guild):
return not self.__eq__(guild)
@property
def icon_url(self):
"""A property returning direct URL to the guild's icon. Returns None if guild has no icon set."""