diff options
| author | Rapptz <[email protected]> | 2019-02-26 08:43:10 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2019-02-26 08:44:25 -0500 |
| commit | bbc4460c38e6d04b8175ce87ddcfce175ec2be26 (patch) | |
| tree | b97f7661870f704bca6f8e7f7d4011a7fc914b4a /discord/emoji.py | |
| parent | Add new cog methods (diff) | |
| download | discord.py-bbc4460c38e6d04b8175ce87ddcfce175ec2be26.tar.xz discord.py-bbc4460c38e6d04b8175ce87ddcfce175ec2be26.zip | |
Fix Emoji.__hash__ being None.
When a type defines __eq__, Python removes its __hash__ function.
Fixes #1933
Diffstat (limited to 'discord/emoji.py')
| -rw-r--r-- | discord/emoji.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/discord/emoji.py b/discord/emoji.py index dafb36d2..2d01e335 100644 --- a/discord/emoji.py +++ b/discord/emoji.py @@ -27,7 +27,6 @@ DEALINGS IN THE SOFTWARE. from collections import namedtuple from . import utils -from .mixins import Hashable class PartialEmoji(namedtuple('PartialEmoji', 'animated name id')): """Represents a "partial" emoji. @@ -104,7 +103,7 @@ class PartialEmoji(namedtuple('PartialEmoji', 'animated name id')): _format = 'gif' if self.animated else 'png' return "https://cdn.discordapp.com/emojis/{0.id}.{1}".format(self, _format) -class Emoji(Hashable): +class Emoji: """Represents a custom emoji. Depending on the way this object was created, some of the attributes can @@ -184,6 +183,9 @@ class Emoji(Hashable): def __eq__(self, other): return isinstance(other, (PartialEmoji, Emoji)) and self.id == other.id + def __hash__(self): + return self.id >> 22 + @property def created_at(self): """Returns the emoji's creation time in UTC.""" |