mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-09 03:07:00 +00:00
Optimise some member and user related routines.
* Skip user update if possible * Drop copy.copy in favour of manual copy Credit to Hornwitser for these findings.
This commit is contained in:
@ -91,6 +91,19 @@ class BaseUser(_BaseUser):
|
||||
def __hash__(self):
|
||||
return self.id >> 22
|
||||
|
||||
@classmethod
|
||||
def _copy(cls, user):
|
||||
self = cls.__new__(cls) # bypass __init__
|
||||
|
||||
self.name = user.name
|
||||
self.id = user.id
|
||||
self.discriminator = user.discriminator
|
||||
self.avatar = user.avatar
|
||||
self.bot = user.bot
|
||||
self._state = user._state
|
||||
|
||||
return self
|
||||
|
||||
@property
|
||||
def avatar_url(self):
|
||||
"""Returns a friendly URL version of the avatar the user has.
|
||||
|
Reference in New Issue
Block a user