Skip to content

Commit

Permalink
Fix Rich Presence being None too much (#589)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aluerie authored Sep 21, 2024
1 parent 213d9b6 commit 485fb4d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions steam/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand Down

0 comments on commit 485fb4d

Please sign in to comment.