fix: 修复获取不到开黑数据时报错的问题
This commit is contained in:
parent
3087dd3085
commit
fd24fc01f7
6
dota.py
6
dota.py
@ -139,12 +139,12 @@ class Friend(BaseModel):
|
|||||||
}
|
}
|
||||||
for match_ in matches[:limit]:
|
for match_ in matches[:limit]:
|
||||||
duration = '%d:%02d:%02d' % utils.convert_seconds_to_hms(match_['duration'])
|
duration = '%d:%02d:%02d' % utils.convert_seconds_to_hms(match_['duration'])
|
||||||
|
summary = f"{duration}"
|
||||||
if match_['party_size'] == None:
|
if match_['party_size'] == None:
|
||||||
if Match.filter(match_id=match_['match_id']).exists():
|
if Match.filter(match_id=match_['match_id']).exists():
|
||||||
match_['party_size'] = Match.get(match_id=match_['match_id']).party_size
|
match_['party_size'] = Match.get(match_id=match_['match_id']).party_size
|
||||||
else:
|
if match_['party_size']:
|
||||||
match_['party_size'] = 0
|
match_['party_size'] = 0
|
||||||
summary = f"{duration}"
|
|
||||||
if match_['party_size'] and match_['party_size'] > 1:
|
if match_['party_size'] and match_['party_size'] > 1:
|
||||||
summary = f"{match_['party_size']}黑 {duration}"
|
summary = f"{match_['party_size']}黑 {duration}"
|
||||||
elif match_['party_size'] and match_['party_size'] == 1:
|
elif match_['party_size'] and match_['party_size'] == 1:
|
||||||
@ -228,12 +228,12 @@ def serialize_match_for_discord(match_):
|
|||||||
is_radiant = player['is_radiant']
|
is_radiant = player['is_radiant']
|
||||||
break
|
break
|
||||||
win = is_radiant == match_['radiant_win']
|
win = is_radiant == match_['radiant_win']
|
||||||
|
summary = f"{match_['duration']}"
|
||||||
if not match_['party_size']:
|
if not match_['party_size']:
|
||||||
if Match.filter(match_id=match_['match_id']).exists():
|
if Match.filter(match_id=match_['match_id']).exists():
|
||||||
match_['party_size'] = Match.get(match_id=match_['match_id']).party_size
|
match_['party_size'] = Match.get(match_id=match_['match_id']).party_size
|
||||||
else:
|
else:
|
||||||
match_['party_size'] = 0
|
match_['party_size'] = 0
|
||||||
summary = f"{match_['duration']}"
|
|
||||||
if match_['party_size'] > 1:
|
if match_['party_size'] > 1:
|
||||||
summary = f"{match_['party_size']}黑 {match_['duration']}"
|
summary = f"{match_['party_size']}黑 {match_['duration']}"
|
||||||
elif match_['party_size'] == 1:
|
elif match_['party_size'] == 1:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user