mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-19 15:36:02 +00:00
Implement PartialEmoji == Emoji (fixes #1627)
This commit is contained in:
parent
85b5286056
commit
ce3ede1551
@ -75,6 +75,13 @@ class PartialEmoji(namedtuple('PartialEmoji', 'animated name id')):
|
||||
return '<a:%s:%s>' % (self.name, self.id)
|
||||
return '<:%s:%s>' % (self.name, self.id)
|
||||
|
||||
def __eq__(self, other):
|
||||
if self.is_unicode_emoji():
|
||||
return isinstance(other, PartialEmoji) and self.name == other.name
|
||||
|
||||
if isinstance(other, (PartialEmoji, Emoji)):
|
||||
return self.id == other.id
|
||||
|
||||
def is_custom_emoji(self):
|
||||
"""Checks if this is a custom non-Unicode emoji."""
|
||||
return self.id is not None
|
||||
@ -174,6 +181,9 @@ class Emoji(Hashable):
|
||||
def __repr__(self):
|
||||
return '<Emoji id={0.id} name={0.name!r}>'.format(self)
|
||||
|
||||
def __eq__(self, other):
|
||||
return isinstance(other, (PartialEmoji, Emoji)) and self.id == other.id
|
||||
|
||||
@property
|
||||
def created_at(self):
|
||||
"""Returns the emoji's creation time in UTC."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user