Fix User == Member comparisons.
This commit is contained in:
		@@ -107,7 +107,7 @@ def flatten_user(cls):
 | 
				
			|||||||
    return cls
 | 
					    return cls
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@flatten_user
 | 
					@flatten_user
 | 
				
			||||||
class Member(discord.abc.Messageable):
 | 
					class Member(discord.abc.Messageable, discord.abc.User):
 | 
				
			||||||
    """Represents a Discord member to a :class:`Guild`.
 | 
					    """Represents a Discord member to a :class:`Guild`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    This implements a lot of the functionality of :class:`User`.
 | 
					    This implements a lot of the functionality of :class:`User`.
 | 
				
			||||||
@@ -170,7 +170,7 @@ class Member(discord.abc.Messageable):
 | 
				
			|||||||
               ' bot={1.bot} nick={0.nick!r} guild={0.guild!r}>'.format(self, self._user)
 | 
					               ' bot={1.bot} nick={0.nick!r} guild={0.guild!r}>'.format(self, self._user)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __eq__(self, other):
 | 
					    def __eq__(self, other):
 | 
				
			||||||
        return isinstance(other, (BaseUser, Member)) and other.id == self.id
 | 
					        return isinstance(other, discord.abc.User) and other.id == self.id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __ne__(self, other):
 | 
					    def __ne__(self, other):
 | 
				
			||||||
        return not self.__eq__(other)
 | 
					        return not self.__eq__(other)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,7 +35,7 @@ import asyncio
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Profile = namedtuple('Profile', 'premium user mutual_guilds connected_accounts premium_since')
 | 
					Profile = namedtuple('Profile', 'premium user mutual_guilds connected_accounts premium_since')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class BaseUser:
 | 
					class BaseUser(discord.abc.User):
 | 
				
			||||||
    __slots__ = ('name', 'id', 'discriminator', 'avatar', 'bot', '_state')
 | 
					    __slots__ = ('name', 'id', 'discriminator', 'avatar', 'bot', '_state')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __init__(self, *, state, data):
 | 
					    def __init__(self, *, state, data):
 | 
				
			||||||
@@ -50,7 +50,7 @@ class BaseUser:
 | 
				
			|||||||
        return '{0.name}#{0.discriminator}'.format(self)
 | 
					        return '{0.name}#{0.discriminator}'.format(self)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __eq__(self, other):
 | 
					    def __eq__(self, other):
 | 
				
			||||||
        return isinstance(other, BaseUser) and other.id == self.id
 | 
					        return isinstance(other, discord.abc.User) and other.id == self.id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __ne__(self, other):
 | 
					    def __ne__(self, other):
 | 
				
			||||||
        return not self.__eq__(other)
 | 
					        return not self.__eq__(other)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user