diff options
| author | Andres Torres <[email protected]> | 2020-09-04 05:42:31 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-09-04 08:42:31 -0400 |
| commit | 39aa08ab937d4ef7d1f796fe611da9495ef5f949 (patch) | |
| tree | 04377beebf8e919c5bacda39f192a400908e77eb | |
| parent | Don't call close() if we've already been closed in Client.run (diff) | |
| download | discord.py-39aa08ab937d4ef7d1f796fe611da9495ef5f949.tar.xz discord.py-39aa08ab937d4ef7d1f796fe611da9495ef5f949.zip | |
Added __eq__ to Message
| -rw-r--r-- | discord/message.py | 3 | ||||
| -rw-r--r-- | docs/api.rst | 9 |
2 files changed, 12 insertions, 0 deletions
diff --git a/discord/message.py b/discord/message.py index e2cfe866..7e8440f4 100644 --- a/discord/message.py +++ b/discord/message.py @@ -347,6 +347,9 @@ class Message: def __repr__(self): return '<Message id={0.id} channel={0.channel!r} type={0.type!r} author={0.author!r} flags={0.flags!r}>'.format(self) + def __eq__(self, other): + return isinstance(other, self.__class__) and self.id == other.id + def _try_patch(self, data, key, transform=None): try: value = data[key] diff --git a/docs/api.rst b/docs/api.rst index 028bc994..759aece6 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -903,6 +903,15 @@ of :class:`enum.Enum`. Specifies the type of :class:`Message`. This is used to denote if a message is to be interpreted as a system message or a regular message. + .. container:: operations + + .. describe:: x == y + + Checks if two messages are equal. + .. describe:: x != y + + Checks if two messages are not equal. + .. attribute:: default The default message type. This is the same as regular messages. |