From 485fb4dcf0e5c5fda78da751428a864b751ebcbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Irene=20Adler=E2=9D=A4?= <33165440+Aluerie@users.noreply.github.com> Date: Sun, 22 Sep 2024 00:33:06 +0300 Subject: [PATCH] Fix Rich Presence being None too much (#589) --- steam/user.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/steam/user.py b/steam/user.py index 219b4975..4b6de660 100644 --- a/steam/user.py +++ b/steam/user.py @@ -62,6 +62,7 @@ class _BaseUser(BaseUser): def __init__(self, state: ConnectionState, proto: UserProto): super().__init__(state, proto.friendid) + self.rich_presence = None # ensure the attr exists self._update(proto) def _update(self, proto: UserProto, /) -> None: @@ -80,9 +81,8 @@ def _update(self, proto: UserProto, /) -> None: """The last time the user logged into steam.""" self.last_seen_online = DateTime.from_timestamp(proto.last_seen_online) """The last time the user could be seen online.""" - self.rich_presence = ( - {message.key: message.value for message in proto.rich_presence} if proto.is_set("rich_presence") else None - ) + if proto.is_set("rich_presence"): + self.rich_presence = {message.key: message.value for message in proto.rich_presence} """The rich presence of the user.""" self.app = ( PartialApp(self._state, name=proto.game_name, id=proto.game_played_app_id)