fix: 修复 openapi 接口报错时,战绩消息为空的问题
This commit is contained in:
parent
f4e17c5126
commit
eddfcbf7f7
7
dota.py
7
dota.py
@ -124,7 +124,12 @@ class Friend(BaseModel):
|
|||||||
if limit > 10:
|
if limit > 10:
|
||||||
limit = 10
|
limit = 10
|
||||||
for friend in friends:
|
for friend in friends:
|
||||||
matches.extend(friend.serialize_recent_matches(limit=limit))
|
matches_ = friend.serialize_recent_matches(limit=limit)
|
||||||
|
if not matches_:
|
||||||
|
continue
|
||||||
|
matches.extend(matches_)
|
||||||
|
if not matches:
|
||||||
|
return None
|
||||||
# sort matches by start_time from latest to oldest
|
# sort matches by start_time from latest to oldest
|
||||||
matches.sort(key=lambda x: x['start_time'], reverse=True)
|
matches.sort(key=lambda x: x['start_time'], reverse=True)
|
||||||
name = friends[0].name
|
name = friends[0].name
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user