Skip to content

Commit f15a6c8

Browse files
committed
Made certain attributes for Member class optional.
1 parent aee97fe commit f15a6c8

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

weverse/objects/member.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -194,20 +194,24 @@ class Member(PartialMember):
194194
The profile comment of the member, if any.
195195
has_joined: :class:`bool`
196196
Whether the member has joined the community.
197-
has_membership: :class:`bool`
198-
Whether the member has a paid membership to the community.
197+
has_membership: :class:`bool` | :class:`None`
198+
Whether the member has a paid membership to the community. Will
199+
return :class:`None` if it is the :class:`Member` object of the group.
199200
is_official: :class:`bool`
200201
Whether the member is an official Weverse account.
201-
is_hidden: :class:`bool`
202-
Whether the member is hidden.
203-
is_blinded: :class:`bool`
204-
Whether the member is blinded.
202+
is_hidden: :class:`bool` | :class:`None`
203+
Whether the member is hidden. Will return :class:`None` if it is the
204+
:class:`Member` object of the group.
205+
is_blinded: :class:`bool` | :class:`None`
206+
Whether the member is blinded. Will return :class:`None` if it is the
207+
:class:`Member` object of the group.
205208
is_followed: :class:`bool`
206209
Whether the signed-in account is following the member.
207210
is_my_profile: :class:`bool`
208211
Whether the member is yourself.
209-
first_joined_at: :class:`int`
210-
The time the member first joined the community at, in epoch.
212+
first_joined_at: :class:`int` | :class:`None`
213+
The time the member first joined the community at, in epoch. Will return
214+
:class:`None` if it is the :class:`Member` object of the group.
211215
follow_count: :class:`int` | :class:`None`
212216
The number of followers the member has, if available.
213217
artist_profile: :class:`ArtistProfile` | :class:`None`
@@ -236,13 +240,13 @@ def __init__(self, data: dict):
236240
self.profile_cover_image_url: str | None = data.get("profileCoverImageUrl")
237241
self.profile_comment: str | None = data.get("profileComment")
238242
self.has_joined: bool = data["joined"]
239-
self.has_membership: bool = data["hasMembership"]
243+
self.has_membership: bool | None = data.get("hasMembership")
240244
self.is_official: bool = data["hasOfficialMark"]
241-
self.is_hidden: bool = data["hidden"]
242-
self.is_blinded: bool = data["blinded"]
245+
self.is_hidden: bool | None = data.get("hidden")
246+
self.is_blinded: bool | None = data.get("blinded")
243247
self.is_followed: bool = data["followed"]
244248
self.is_my_profile: bool = data["myProfile"]
245-
self.first_joined_at: int = data["firstJoinAt"]
249+
self.first_joined_at: int | None = data.get("firstJoinAt")
246250
self.follow_count: int | None = (
247251
data["followCount"]["followerCount"] if "followCount" in data else None
248252
)

0 commit comments

Comments
 (0)