Skip to content

Commit 27aabd4

Browse files
committed
Instantiate PrimaryGuild object in BaseUser
Replaces direct assignment of primary_guild with instantiation of a PrimaryGuild object when data is present, ensuring consistent object structure for user attributes.
1 parent 8598e8a commit 27aabd4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

discord/user.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,11 @@ def _update(self, data: UserPayload) -> None:
154154
self.nameplate = Nameplate(data=nameplate, state=self._state)
155155
else:
156156
self.nameplate = None
157-
self.primary_guild = data.get("primary_guild", None)
157+
primary_guild = data.get("primary_guild", None)
158+
if primary_guild:
159+
self.primary_guild = PrimaryGuild(data=primary_guild, state=self._state)
160+
else:
161+
self.primary_guild = None
158162
self._public_flags = data.get("public_flags", 0)
159163
self.bot = data.get("bot", False)
160164
self.system = data.get("system", False)

0 commit comments

Comments
 (0)