From fd3ff4bb0198574d12e728625f47a80a8115ac45 Mon Sep 17 00:00:00 2001 From: dolfies Date: Wed, 21 Sep 2022 21:22:07 -0400 Subject: [PATCH] Document nsfw_allowed being nullable --- discord/types/user.py | 3 +++ discord/user.py | 9 ++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/discord/types/user.py b/discord/types/user.py index cf16125c1..b394dd802 100644 --- a/discord/types/user.py +++ b/discord/types/user.py @@ -69,6 +69,8 @@ class User(PartialUser, total=False): verified: bool email: Optional[str] flags: int + purchased_flags: int + premium_usage_flags: int premium_type: PremiumType public_flags: int banner: Optional[str] @@ -77,6 +79,7 @@ class User(PartialUser, total=False): analytics_token: str phone: Optional[str] token: str + nsfw_allowed: Optional[bool] class PartialConnection(TypedDict): diff --git a/discord/user.py b/discord/user.py index 54260bd25..8c04f2388 100644 --- a/discord/user.py +++ b/discord/user.py @@ -523,8 +523,9 @@ class ClientUser(BaseUser): The user's note. Not pre-fetched. .. versionadded:: 1.9 - nsfw_allowed: :class:`bool` + nsfw_allowed: Optional[:class:`bool`] Specifies if the user should be allowed to access NSFW content. + If ``None``, then the user's date of birth is not known. .. versionadded:: 2.0 """ @@ -554,7 +555,7 @@ class ClientUser(BaseUser): mfa_enabled: bool premium_type: Optional[PremiumType] bio: Optional[str] - nsfw_allowed: bool + nsfw_allowed: Optional[bool] def __init__(self, *, state: ConnectionState, data: UserPayload) -> None: self._state = state @@ -579,9 +580,7 @@ class ClientUser(BaseUser): self.mfa_enabled = data.get('mfa_enabled', False) self.premium_type = try_enum(PremiumType, data['premium_type']) if 'premium_type' in data else None self.bio = data.get('bio') - self.nsfw_allowed = data.get('nsfw_allowed', False) - self.bio = data.get('bio') or None - self.nsfw_allowed = data.get('nsfw_allowed', False) + self.nsfw_allowed = data.get('nsfw_allowed') def get_relationship(self, user_id: int) -> Optional[Relationship]: """Retrieves the :class:`Relationship` if applicable.