Browse Source

Added __eq__ to Message

pull/5793/head
Andres Torres 5 years ago
committed by GitHub
parent
commit
39aa08ab93
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      discord/message.py
  2. 9
      docs/api.rst

3
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]

9
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.

Loading…
Cancel
Save