Skip to content

Commit

Permalink
SteamLeaderboard: make data param optional
Browse files Browse the repository at this point in the history
  • Loading branch information
rossengeorgiev committed Oct 22, 2021
1 parent 053bbdc commit 3275225
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions steam/client/builtins/leaderboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,14 @@ class SteamLeaderboard(object):
display_type = ELeaderboardDisplayType.NONE #: :class:`steam.enums.common.ELeaderboardDisplayType`
data_request = ELeaderboardDataRequest.Global #: :class:`steam.enums.common.ELeaderboardDataRequest`

def __init__(self, steam, app_id, name, data):
def __init__(self, steam, app_id, name, data=None):
self._steam = steam
self.app_id = app_id

for field in data.DESCRIPTOR.fields:
if field.name.startswith('leaderboard_'):
self.__dict__[field.name.replace('leaderboard_', '')] = getattr(data, field.name)
if data is not None:
for field in data.DESCRIPTOR.fields:
if field.name.startswith('leaderboard_'):
self.__dict__[field.name.replace('leaderboard_', '')] = getattr(data, field.name)

self.sort_method = ELeaderboardSortMethod(self.sort_method)
self.display_type = ELeaderboardDisplayType(self.display_type)
Expand Down

0 comments on commit 3275225

Please sign in to comment.