|
@ -27,6 +27,7 @@ DEALINGS IN THE SOFTWARE. |
|
|
from collections import namedtuple |
|
|
from collections import namedtuple |
|
|
|
|
|
|
|
|
import discord.abc |
|
|
import discord.abc |
|
|
|
|
|
from .flags import PublicUserFlags |
|
|
from .utils import snowflake_time, _bytes_to_base64_data, parse_time |
|
|
from .utils import snowflake_time, _bytes_to_base64_data, parse_time |
|
|
from .enums import DefaultAvatar, RelationshipType, UserFlags, HypeSquadHouse, PremiumType, try_enum |
|
|
from .enums import DefaultAvatar, RelationshipType, UserFlags, HypeSquadHouse, PremiumType, try_enum |
|
|
from .errors import ClientException |
|
|
from .errors import ClientException |
|
@ -82,7 +83,7 @@ class Profile(namedtuple('Profile', 'flags user mutual_guilds connected_accounts |
|
|
_BaseUser = discord.abc.User |
|
|
_BaseUser = discord.abc.User |
|
|
|
|
|
|
|
|
class BaseUser(_BaseUser): |
|
|
class BaseUser(_BaseUser): |
|
|
__slots__ = ('name', 'id', 'discriminator', 'avatar', 'bot', 'system', '_state') |
|
|
__slots__ = ('name', 'id', 'discriminator', 'avatar', 'bot', 'system', '_public_flags', '_state') |
|
|
|
|
|
|
|
|
def __init__(self, *, state, data): |
|
|
def __init__(self, *, state, data): |
|
|
self._state = state |
|
|
self._state = state |
|
@ -105,6 +106,7 @@ class BaseUser(_BaseUser): |
|
|
self.id = int(data['id']) |
|
|
self.id = int(data['id']) |
|
|
self.discriminator = data['discriminator'] |
|
|
self.discriminator = data['discriminator'] |
|
|
self.avatar = data['avatar'] |
|
|
self.avatar = data['avatar'] |
|
|
|
|
|
self._public_flags = data.get('public_flags', 0) |
|
|
self.bot = data.get('bot', False) |
|
|
self.bot = data.get('bot', False) |
|
|
self.system = data.get('system', False) |
|
|
self.system = data.get('system', False) |
|
|
|
|
|
|
|
@ -130,6 +132,11 @@ class BaseUser(_BaseUser): |
|
|
'bot': self.bot, |
|
|
'bot': self.bot, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@property |
|
|
|
|
|
def public_flags(self): |
|
|
|
|
|
""":class:`PublicFlags`: The publicly available flags the user has.""" |
|
|
|
|
|
return PublicUserFlags._from_value(self._public_flags) |
|
|
|
|
|
|
|
|
@property |
|
|
@property |
|
|
def avatar_url(self): |
|
|
def avatar_url(self): |
|
|
"""Returns an :class:`Asset` for the avatar the user has. |
|
|
"""Returns an :class:`Asset` for the avatar the user has. |
|
|