Improve performance of value -> enum by about 5x.

This commit is contained in:
Rapptz committed 2019-04-15 21:30:47 -04:00
1 parent 2a301a4eb4
commit 6f26a4aad8
3 files changed
+57 -4

No files matched your search

+1 -1
View File
@@ -164,7 +164,7 @@ class BaseUser(_BaseUser):
@property
def default_avatar(self):
"""Returns the default avatar for a given user. This is calculated by the user's discriminator"""
return DefaultAvatar(int(self.discriminator) % len(DefaultAvatar))
return try_enum(DefaultAvatar, int(self.discriminator) % len(DefaultAvatar))
@property
def default_avatar_url(self):